Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. $SERVER = "localhost";
  3. $USER = "root";
  4. $PASSWORD = "youwillnotseethis";
  5. $DATABASE = "reg_db";
  6. $TABLE = "user";
  7.  
  8. mysql_connect('$SERVER','$USER','$PASSWORD') or die("Can't conncet" . mysql_error());
  9. mysql_select_db("$DATABASE") or die("Couldn't find the DB");
  10.  
  11. $user=$_POST['user'];
  12. $pass=$_POST['pass'];
  13.  
  14. $sql="SELECT * FROM $TABLE WHERE username='$user' and password='$pass';
  15. $result=mysql_query($sql);
  16.  
  17. $count=mysql_num_rows($results);
  18.  
  19. if($count==1){
  20.  
  21. session_register("user");
  22. session_register("pass");
  23. header("location:login_success.php");
  24. }
  25. else {
  26. echo "Wrong username or Password";
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement