Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. // Connects to your Database
  3. mysql_connect("localhost", "root", "1Slm52HZ") or die(mysql_error());
  4. mysql_select_db("miq") or die(mysql_error());
  5. //checks cookies to make sure they are logged in
  6. if(isset($_COOKIE['ID_my_site']))
  7. {
  8. $username = $_COOKIE['ID_my_site'];
  9. $pass = $_COOKIE['Key_my_site'];
  10. $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
  11. while($info = mysql_fetch_array( $check ))
  12. {
  13.  
  14. //if the cookie has the wrong password, they are taken to the login page
  15. if ($pass != $info['password'])
  16. { header("Location: login.php");
  17. }
  18.  
  19. //otherwise they are shown the user area
  20. else
  21. {
  22. }
  23. }
  24. }
  25. else
  26.  
  27. //if the cookie does not exist, they are taken to the login screen
  28. {
  29. header("Location: login.php");
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement