Skip to content

Instantly share code, notes, and snippets.

Created August 9, 2015 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/8a77f4cbd2929bc782c1 to your computer and use it in GitHub Desktop.
Save anonymous/8a77f4cbd2929bc782c1 to your computer and use it in GitHub Desktop.
<?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;
}
@alperb
Copy link

alperb commented Aug 11, 2016

pretty nice xd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment