Created
May 29, 2014 22:27
-
-
Save magmastonealex/71f6a787205f2657f99f to your computer and use it in GitHub Desktop.
Music Logins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST["username"])){ | |
$un=$_POST["username"]; | |
$pw=$_POST["password"]; | |
if(verify($un,$pw)){ | |
echo "Correct username/password!"; | |
}else{ | |
echo "Incorrect username/password!"; | |
} | |
} | |
function verify($username, $password){ | |
$fields = array( | |
"__LASTFOCUS"=>"", | |
"__VIEWSTATE"=>"/wEPDwUKMTU2MTYyMjAwNGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJmN0bDAwJENvbnRlbnRQbGFjZUhvbGRlcjEkU3VibWl0QnV0dG9u", | |
"__EVENTTARGET"=>"", | |
"__EVENTARGUMENT"=>"", | |
"__EVENTVALIDATION"=>"/wEWBQKE0smvCgLnmcnFAQKzpa6MBwKo77JuAunYybIM", | |
"__db"=>"14", | |
"ctl00\$ContentPlaceHolder1\$UsernameTextBox"=>$username, | |
"ctl00\$ContentPlaceHolder1\$PasswordTextBox"=>$password, | |
"ctl00\$ContentPlaceHolder1\$SubmitButton.x"=>"66", | |
"ctl00\$ContentPlaceHolder1\$SubmitButton.y"=>"21" | |
); | |
$fields_string=""; | |
//url-ify the data for the POST | |
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } | |
rtrim($fields_string, '&'); | |
//echo $fields_string; | |
//open connection | |
$ch = curl_init(); | |
$url="https://fed.pdsb.org//adfs/ls/?wa=wsignin1.0&wtrealm=urn%3apdsb%3asharepoint&wctx=https%3a%2f%2fbyod.peelschools.org%2f_layouts%2fAuthenticate.aspx%3fSource%3d%252F"; | |
//$url="https://byod.peelschools.org/F"; | |
//set the url, number of POST vars, POST data | |
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36'); | |
curl_setopt($ch,CURLOPT_URL, $url); | |
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | |
curl_setopt($ch,CURLOPT_POST, 1); | |
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields); | |
echo curl_error($ch); | |
//execute post | |
$result = curl_exec($ch); | |
//echo $result; | |
if(strpos($result, "Object moved to")){ | |
return TRUE; | |
}else{ | |
return FALSE; | |
} | |
//echo $result; | |
//close connection | |
curl_close($ch); | |
} | |
?> | |
<form method="POST"> | |
<input type="text" name="username" id="username"/> | |
<input type="password" name="password" id="password"/> | |
<input type="submit"> | |
</form> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment