Created
January 14, 2017 12:01
-
-
Save M4sterZer0/c56f26d1c97ff4e3e14cbc8b25d820af to your computer and use it in GitHub Desktop.
MyBB 1.8 Login-Check API
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 | |
define('IN_MYBB', false); | |
require_once './global.php'; | |
if($_POST["apikey"] == "YOURAPIKEYHERE") | |
{ | |
if($_GET["action"] == "login") | |
{ | |
$query = $db->query("SELECT * FROM " . TABLE_PREFIX . " WHERE username='".$db->escape_string($_POST['username'])."'"); | |
if($query->num_rows == 0) | |
{ | |
echo "USER_NOTFOUND"; | |
} else { | |
while($result = $db->fetch_array($query)) | |
{ | |
$end_password = $result['password']; | |
if(md5(md5($result['salt']).md5($_POST["password"])) == $end_password) | |
{ | |
echo "OK_LOGINSUCCESS"; | |
} else { | |
echo "FAIL_WRONGLOGINDATA"; | |
} | |
} | |
} | |
} | |
} else { | |
die("Access denied."); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It was created for a Ingame login.
You can use the function from mybb too "validate_password_from_username".
https://github.com/mybb/mybb/blob/f6e6cadccc9ed94b5324bb57aff7fe3f3f48999f/inc/functions_user.php#L54