That is. Basically what the script does is the following:
Code:
<?php
// Connects to your Database
mysql_connect("XXXXX", "braden_gaming", "XXXXX") or die(mysql_error());
mysql_select_db("braden_gaming") or die(mysql_error());
connect to the database
Code:
//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_my_site']))
{
if the cookie is set, then contiue
Code:
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
assign some variables ($username and $pass), then check the database table "users" for that username. If no results, then kill the script and print the mysql error.
Code:
while($info = mysql_fetch_array( $check ))
{
basically, while you are fetching the columns associated with the above query to the database, continue executing the script
Code:
//if the cookie has the wrong password, they are taken to the login page
if ($pass != $info['password'])
{ header("Location: login.php");
}
as the comments say, redirect (which will fail) if the password info is wrong.
Code:
//otherwise they are shown the admin area
else
{
echo "Admin Area<p>";
echo "<a href=logout.php>Logout</a>";
}
Show the stuff above if the login info is correct.
Code:
$tag = $info['tag'];
?>
<iframe src="http://gamercard.xbox.com/<?php echo $tag; ?>.card" scrolling="no" frameBorder="0" height="140" width="204"><?php echo $tag; ?></iframe>
<?php
}
assign the variable $tag and show the iframe
Code:
}
else
//if the cookie does not exist, they are taken to the login screen
{
header("Location: login.php");
}
Again, a failed redirect if the cookie doesn't exist.
To get the header redirects to work properly, you need to make sure that any text is sent to the browser after the header() tag.
Hope this helps.
Bookmarks