commit 8beea8ce6ead2d25394e2f34f6b3a8ade62f59a4 Author: Kenneth Jao Date: Wed Dec 13 22:31:18 2017 -0500 Initial commit, user login and retrieval working diff --git a/zanglenotify/index.php b/zanglenotify/index.php new file mode 100644 index 0000000..9d0c20e --- /dev/null +++ b/zanglenotify/index.php @@ -0,0 +1,92 @@ +)/', $output, $tr); + preg_match('/(\s*id\s*=\s*"[^"]*")/', $tr[0], $match); + return preg_replace('/(["=\s[id])/', "", $match[0]); + } + + function selectUser($user, $cookie) { + $c = curl_init(); + $url = 'https://webconnect.bloomfield.org/zangle/StudentPortal/StudentBanner/SetStudentBanner/'.$user; + + curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_COOKIE, $cookie); + curl_setopt($c, CURLOPT_HEADER, 0); + curl_setopt($c, CURLOPT_FOLLOWLOCATION,1); + curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); + curl_exec($c); + } + + function getAssignments($cookie) { + $c = curl_init(); + $url = 'https://webconnect.bloomfield.org/zangle/StudentPortal/Home/LoadProfileData/Assignments'; + + curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_COOKIE, $cookie); + curl_setopt($c, CURLOPT_HEADER, 0); + curl_setopt($c, CURLOPT_FOLLOWLOCATION,1); + curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); + $output = curl_exec($c); + } + + if(isset($_POST['Pin']) && !empty($_POST['Pin'])) { + $pin = $_POST['Pin']; + } + + if(isset($_POST['Password']) && !empty($_POST['Password'])) { + $password = $_POST['Password']; + } + + $cookie = getCookie(); + $loggedIn = loginUser($pin, $password, $cookie); + $mainPageUserId = getMain($cookie); + selectUser($mainPageUserId, $cookie); + $assignments = getAssignments($cookie); + + echo $assignments; +?> \ No newline at end of file