login, logs out....lol

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
Admin Panel

Main Admin Page
Link1
Link2

Header 2

Link3
Link4

Header 3

Link5
Link6

Header 4

Link7
Link8

Header 5

Link9
Link10

Header 6

Link11
Link12

  <?

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 { ?>
Name:
Password:
<? } ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service