Skip to content

Instantly share code, notes, and snippets.

@M4sterZer0
Created January 14, 2017 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M4sterZer0/c56f26d1c97ff4e3e14cbc8b25d820af to your computer and use it in GitHub Desktop.
Save M4sterZer0/c56f26d1c97ff4e3e14cbc8b25d820af to your computer and use it in GitHub Desktop.
MyBB 1.8 Login-Check API
<?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.");
}
?>
@M4sterZer0
Copy link
Author

M4sterZer0 commented Jan 14, 2017

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

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