Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <?php
  2. //Load SQL info
  3. require_once "../admin/paths.php";
  4.  
  5. //Set var for access
  6. $page=substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
  7. $page2='/cms/';
  8. // Connects to your Database
  9. mysql_connect("$SQLHOST", "$SQLUSER", "$SQLPASS") or die(mysql_error());
  10. mysql_select_db("$SQLDB") or die(mysql_error());
  11.  
  12. //checks cookies to make sure they are logged in
  13. if(isset($_COOKIE['ID_my_site']))
  14. {
  15. $username = $_COOKIE['ID_my_site'];
  16. $pass = $_COOKIE['Key_my_site'];
  17. $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
  18. while($info = mysql_fetch_array( $check ))
  19. {
  20. //if the cookie has the wrong password, they are taken to the login page
  21. if ($pass != $info['password'])
  22. { header("Location: ../login/login.php");
  23. }
  24.  
  25. }
  26. }
  27.  
  28. else
  29.  
  30. //if the cookie does not exist, they are taken to the login screen
  31. {
  32. header("Location: ../login/login.php");
  33. }
  34. mysql_close()
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement