Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. //Connects to your Database (info removed)
  3.  //checks cookies to make sure they are logged in
  4.  if(isset($_COOKIE['ID_your_site'])){
  5.     $username = $_COOKIE['ID_your_site'];
  6.     $pass = $_COOKIE['Key_your_site'];
  7.     $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
  8.     while($info = mysql_fetch_array( $check )){
  9.         //if the cookie has the wrong password, they are taken to the login page
  10.         if ($pass != $info['password']){
  11.             header("Location: login.html");
  12.         }
  13.         //otherwise they are shown the admin area
  14.     }
  15. }
  16.  else{ //if the cookie does not exist, they are taken to the login screen
  17.     header("Location: login.html");
  18.  }
  19.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement