php - check user password in mybb -
i use script check mybb password error: " no ". used mybb password encryption method don't know why isn't working?
<?php error_reporting(-1); $mysql_host = "localhost"; $mysql_user = "root"; $mysql_pass = ""; $mysql_db = "mybb"; $username = 'me'; $password = 'you'; mysql_connect("$mysql_host", "$mysql_user", "$mysql_pass") or die(mysql_error()); echo "connected mysql<br />"; mysql_select_db("$mysql_db") or die(mysql_error()); $result = mysql_query("select uid, password, email mybb_users username='".$username."' , password='".md5(md5($salt).md5($password))."';"); if (!$result) { die('invalid query: ' . mysql_error()); } if( md5(md5($salt).md5($password)) == $result[ 0 ][ 'password' ] ) { echo "yes" ; //i need option return array( 'id' => $result[ 0 ][ 'uid' ], 'mail' => $result[ 0 ][ 'email' ], 'user' => $username ); } else echo "no"; ?>
$result[ 0 ][ 'password' ]
empty because forgot fetch:
$result = mysql_query("select uid, password, email mybb_users username='".$username."' , password='".md5(md5($salt).md5($password))."';"); if (!$result) { die('invalid query: ' . mysql_error()); } $row = mysql_fetch_assoc($result);
and check if record exists:
if( $row !== false ) { echo "yes" ; //i need option return array( 'id' => $row[ 'uid' ], 'mail' => $row[ 'email' ], 'user' => $username ); } else echo "no";
Comments
Post a Comment