Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2. // Connects to your Database
  3. mysql_connect("localhost", "root", "owwned") or die(mysql_error());
  4. mysql_select_db("ugmed") 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 admin area
  20. else
  21. {
  22. echo "Admin Area<p>";
  23. echo "Your Content<p>";
  24. echo "<a href=logout.php>Logout</a>";
  25. }
  26. }
  27. }
  28.  
  29.  
  30. else
  31.  
  32. //if the cookie does not exist, they are taken to the login screen
  33.  
  34. echo <meta HTTP-EQUIV="REFRESH" content="0; url=login.php">
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement