Guest User

Untitled

a guest
Jun 24th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php
  2. include("php-cont.php");
  3. session_start();
  4.  
  5.  
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8.  
  9. if($username && $password)
  10. {
  11.     $connect = mysql_connect("$LocalHost", "$Username", "$Password") or die("Couldn't connect!");
  12.     mysql_select_db("$DataBase") or die("Couldn't find db");
  13.    
  14.     $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  15.    
  16.     $numrows = mysql_num_rows($query);
  17.    
  18.     if($numrows != 0)
  19.     {
  20.        
  21.         while($row = mysql_fetch_assoc($query))
  22.         {
  23.             $dbusername = $row['username'];
  24.             $dbpassword = $row['password'];
  25.             $activation = $row['activation'];
  26.            
  27.             if($activation == '0')
  28.             {
  29.                 die("Your account has not been activated. Please check your email to Activate!");
  30.                 exit();
  31.             }
  32.            
  33.            
  34.         }
  35.         // check to see if they match!
  36.         if($username == $dbusername && md5($password) == $dbpassword)
  37.         {
  38.             echo "You're in! <a href='member.php'>Click</a> here to enter the member page.";
  39.             $_SESSION['username'] = $dbusername;
  40.         }
  41.         else
  42.         {
  43.             echo("Entered wrong password!");
  44.             echo($username."/".$dbusername."/".md5($password)."/".$dbpassword);
  45.             }
  46.  
  47.     }
  48.     else
  49.         die("That user doesn't exit");
  50.    
  51.    
  52. }
  53. else
  54.     die("Please enter a username and password.");
  55.  
  56.  
  57.  
  58. ?>
Add Comment
Please, Sign In to add comment