Advertisement
Guest User

Untitled

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