Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Load SQL info
- require_once "../admin/paths.php";
- //Set var for access
- $page=substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
- $page2='/cms/';
- // Connects to your Database
- mysql_connect("$SQLHOST", "$SQLUSER", "$SQLPASS") or die(mysql_error());
- mysql_select_db("$SQLDB") or die(mysql_error());
- //checks cookies to make sure they are logged in
- if(isset($_COOKIE['ID_my_site']))
- {
- $username = $_COOKIE['ID_my_site'];
- $pass = $_COOKIE['Key_my_site'];
- $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
- while($info = mysql_fetch_array( $check ))
- {
- //if the cookie has the wrong password, they are taken to the login page
- if ($pass != $info['password'])
- { header("Location: ../login/login.php");
- }
- }
- }
- else
- //if the cookie does not exist, they are taken to the login screen
- {
- header("Location: ../login/login.php");
- }
- mysql_close()
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement