Created
August 9, 2015 10:35
-
-
Save anonymous/8a77f4cbd2929bc782c1 to your computer and use it in GitHub Desktop.
This file contains 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($_GET['username']) || !isset($_GET['password'])) { | |
echo 'Missing data!'; | |
} else { | |
$state = AuthMeCheck($_GET['username'], $_GET['password']); | |
if ($state == 1) { | |
echo 'Logged in!'; | |
} else { | |
echo 'Wrong username or password!'; | |
} | |
} | |
function AuthMeCheck($username, $password) { | |
$host = "hostname or ip"; | |
$id = "username"; | |
$pass = "password"; | |
$dbn = "database name"; | |
$db = mysqli_connect($host, $id, $pass, $dbn, 3306); | |
$authmeTable = 'authme'; | |
if($pwd = explode('$', mysqli_fetch_assoc(mysqli_query($db, 'SELECT password FROM '.$authmeTable.' WHERE username="'.$username.'"'))['password'])) | |
if(strcasecmp(trim($pwd['3']), hash('sha256', hash('sha256', $password).$pwd['2'])) == 0) | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pretty nice xd