Guest User

Untitled

a guest
Jun 26th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. include("php-cont.php");
  3. session_start();
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8.  
  9. if($username && $password)
  10. {
  11.    
  12.     $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  13.    
  14.     $numrows = mysql_num_rows($query);
  15.    
  16.     if($numrows != 0)
  17.     {
  18.        
  19.         while($row = mysql_fetch_assoc($query))
  20.         {
  21.             $dbusername = $row['username'];
  22.             $dbemail = $row['email'];
  23.             $dbpassword = $row['password'];
  24.             $activation = $row['activation'];
  25.  
  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.             $_SESSION['email'] = $dbemail;
  41.         }
  42.         else
  43.         {
  44.             echo("Entered wrong password!");
  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. <html>
  57. <head>
  58. <body>
  59. <center>
  60. <h1>Success!</h1>
  61.  
  62.    
  63.    
  64.  
  65.  
  66.  
  67. </center>
  68.  
  69. </body>
  70. </head>
  71. </html>
Add Comment
Please, Sign In to add comment