Guest User

Untitled

a guest
Jun 23rd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1.     public function checkLogin(){
  2.                
  3.         if (isset($_GET['page']) && ($_GET['page'] == 'signup'))
  4.         {
  5.             return false;   //prevents the 'incorrect username/pw' message from being displayed, since both use the same 'post' variable names
  6.         }
  7.         else if ( isset($_POST['username']) && isset($_POST['password']))
  8.         {  
  9.             if ( $_POST['username'] )
  10.                 $username = mysql_real_escape_string($_POST['username']);
  11.             if ( $_POST['password'] )
  12.                 $password = mysql_real_escape_string($_POST['password']);
  13.            
  14.             $password = md5($password . 's4lt_141812');
  15.            
  16.             $q = "SELECT * FROM usertable WHERE user_name = '$username' AND user_password = '$password'";
  17.             $r = mysql_query($q);          
  18.                        
  19.             if ( $r !== false && mysql_num_rows($r) > 0 )
  20.             {
  21.             //  echo '<p>Successfully logged in</p>';
  22.                 $_SESSION['username'] = $username;
  23.             }
  24.             else
  25.                 echo '<p>Incorrect username / password combination</p>';
  26.         }
  27.     }
Add Comment
Please, Sign In to add comment