php - return same uid and email for all users in mybb -


hi have class login check username , password of mybb external script seems work small problem. different users result return same uid , email users (the first uid , email in mybb_users table). pleas how fix that. thank me.

class login {     function checklogin( $username, $password )     {             $mysql_host = "localhost"; $mysql_user = "root"; $mysql_pass = ""; $mysql_db = ""; $tbl_name = "";      // connect server , select databse.      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());     // echo "connected database<br />";          $sql="select * $tbl_name username='$username'";         $result=mysql_query($sql);                    if( $result == false )             return false; //              fwrite($fh, $result); //              fclose($fh);           $count=mysql_num_rows($result);         // if result matched $username , $password, table row must 1 row         if($count==1){             $row = mysql_fetch_assoc($result);             global $mybb;             if (md5(md5($row['salt']).md5($password)) == $row['password']){             return array( 'uid' =>  $mybb->user['uid'] ,                           'mail' => $mybb->user[ 'email' ],                           'user' => $username                         );             }         }     } } 

change script following , try it.

return array( 'uid'  => $row['uid'] ,               'mail' => $row['email'],               'user' => $username             ); 

i think work.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -