Note that there are some explanatory texts on larger screens.

plurals
  1. POcheck databes if the result same with table value
    primarykey
    data
    text
    <p>guys with this script i can check the username and password so its rturn 2 value for me</p> <pre><code> if( $result == false ) { $packet-&gt;AddDWValue( "fail" ); $packet-&gt;AddDWValue( "incorrect username and/or password" ); .... </code></pre> <p>and if user pass true:</p> <pre><code> $packet-&gt;AddDWValue( "ok" ); $packet-&gt;AddDWValue( "nice." ); .... </code></pre> <p>But also i need to check other table named "usergroup" so if the value of this table is "7" rerun other value such as:</p> <pre><code> if( $result == false ) { $packet-&gt;AddDWValue( "fail" ); $packet-&gt;AddDWValue( "you are banned" ); .... </code></pre> <p>but i confused how do that so pleas if possible help me.</p> <p>This is my code:</p> <pre><code> &lt;? class Login { function CheckLogin( $username, $password ) { $MySQL_Host = "localhost"; $MySQL_User = "1"; $MySQL_Pass = "2"; $MySQL_DB = "3"; $tbl_name = "mybb_users"; mysql_connect("$MySQL_Host", "$MySQL_User", "$MySQL_Pass") or die(mysql_error()); mysql_select_db("$MySQL_DB") or die(mysql_error()); $sql="SELECT * FROM $tbl_name WHERE 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 and $password, table row must be 1 row if($count==1){ $row = mysql_fetch_assoc($result); //global $mybb; if (md5(md5($row['salt']).md5($password)) == $row['password'] ){ return array( 'uid' =&gt; $row['uid'] , 'mail' =&gt; $row['email'], 'user' =&gt; $username ); } } } } class DWAuth { var $keys; function AddDWValue( $val ) { $this-&gt;keys[] = $val; } function GetAuthString( ) { $result = ""; foreach( $this-&gt;keys as $c ) { $result .= $c."#"; } return $result; } } $login = new Login(); $result = $login-&gt;CheckLogin( $result[ 'user' ], $result[ 'pass' ] ); if( $result == false ) { $packet-&gt;AddDWValue( "fail" ); $packet-&gt;AddDWValue( "incorrect username and/or password" ); $packet-&gt;AddDWValue( 1 ); $packet-&gt;AddDWValue( "Anonymous" ); $packet-&gt;AddDWValue( "anonymous@example.com" ); $packet-&gt;AddDWValue( 0 ); } else { $sessionID = md5( rand() ); $packet-&gt;AddDWValue( "ok" ); $packet-&gt;AddDWValue( "nice." ); $packet-&gt;AddDWValue( $result[ 'uid' ] ); $packet-&gt;AddDWValue( $result[ 'user' ] ); $packet-&gt;AddDWValue( $result[ 'mail' ] ); $packet-&gt;AddDWValue( $sessionID ); } echo $packet-&gt;GetAuthString(); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload