I will post all my code at the bottom, pretty long.
My problem is, when I login with username and password, for some reason, it does not log in, it kind of logs out. I dont know if its the line below,
//this is to keep the admin logged in… until they click logout
if(isset($_COOKIE[‘admin’]) == “loggedin”) {
Or if this line just isnt working at the top of script.
if($_SERVER[‘QUERY_STRING’] == “login”) {
or if its something else.
But, been out of coding php for 3 years, driving me nuts.
<?
error_reporting(E_ALL);
if($_SERVER['QUERY_STRING'] == "login") {
include('var.php');
if ($_POST["user"] == $login && $_POST["password"] == $pass) {
// this is how you set the cookie
setcookie("admin", "loggedin", "+3600");
header('Location: index.php');
}
else {
echo "
";
echo "Wrong Password Or UserName";
}
}
elseif($_SERVER['QUERY_STRING'] == "logout") {
//this is to take the cookie away
setcookie("admin", "loggedout", "-3600");
header('Location: index.php');
}
?>
Crazy Coderz: Administration
<? include('css.php'); ?>
<?
//this is to keep the admin logged in… until they click logout
if(isset($_COOKIE[‘admin’]) == “loggedin”) {
?>
Crazy Coderz: Administration
|
|
logout
|
|
<?
if($_SERVER[‘QUERY_STRING’] == “link1”) {
?>
Link1!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link2") {
?>
Link2!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link3") {
?>
Link3!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link4") {
?>
Link4!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link5") {
?>
Link5!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link6") {
?>
Link6!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link7") {
?>
Link7!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link8") {
?>
Link8!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link9") {
?>
Link9!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link10") {
?>
Link10!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link11") {
?>
Link11!!!
<?
}
elseif($_SERVER['QUERY_STRING'] == "link12") {
?>
Link12!!!
<?
}
else{
?>
Main Admin Page
<?
}
?>
|
|
|
|
<? } else { ?>
<? } ?>