Advertisement
Guest User

Untitled

a guest
Jul 1st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php include 'connect.php';
  2. // Connects to your Database
  3.  
  4. mysql_connect("$host", "$username", "$password") or die(mysql_error());
  5.  
  6. mysql_select_db("$db_name") or die(mysql_error());
  7.  
  8.  
  9. //checks cookies to make sure they are logged in
  10.  
  11. if(isset($_COOKIE['ID_my_site']))
  12.  
  13. {
  14.  
  15. $username = $_COOKIE['ID_my_site'];
  16.  
  17. $pass = $_COOKIE['Key_my_site'];
  18.  
  19. $check = mysql_query("SELECT * FROM Users WHERE Username = '$username'")or die(mysql_error());
  20.  
  21. while($info = mysql_fetch_array( $check ))
  22.  
  23. {
  24.  
  25.  
  26.  
  27. //if the cookie has the wrong password, they are taken to the login page
  28.  
  29. if ($_COOKIE['Logged'] != 1)
  30.  
  31. { header("Location: ../login.php");
  32.  
  33. }
  34. else
  35. {
  36. if($_COOKIE['AdminLogged'] != 1)
  37. {
  38. header("Location: confirm.php");
  39. }
  40. else
  41. {
  42. }
  43. }
  44.  
  45.  
  46.  
  47. //otherwise they are shown the admin area
  48.  
  49. }
  50.  
  51. }
  52.  
  53. else
  54.  
  55.  
  56.  
  57. //if the cookie does not exist, they are taken to the login screen
  58.  
  59. {
  60.  
  61. header("Location: ../login.php");
  62.  
  63. }
  64.  
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement