Cookies Problem
Posted: Sat Nov 02, 2002 10:23 pm
hey for some reason I just can't this to work right I spent 3 hours debugging and im not any closer than when i started.
Excert From global.php
Excert From index.php
Login.inc
Cookies won't set themselves right, or something around there is messed up and I cant figure it out. Hopefully a few other people looking @ it can find a careless mistake or a way to fix it.
Excert From global.php
Code: Select all
// ########## FUNCTION DESC: Admin Login Page ##########
function displayLogin($error) {
include("./templates/login.inc");
echo $error;
}
// ########## Start Stuff For Cookies ##########
if (($HTTP_POST_VARSї'username'] == TRUE) && ($HTTP_GET_VARSї'action'] == "checklogin")) {
$username = $HTTP_POST_VARSї'username'];
$password = $HTTP_POST_VARSї'password'];
dbConnect();
$password2 = mysql_query("SELECT password FROM userinfo WHERE username = '" . $username . "'") or die(mysql_error());
if ($password == $password2) {
setcookie("username", $username, time()+3600);
setcookie("password", $password, time()+3600);
}
elseif ($password != $password2) {
displayLogin("Mismatch");
exit;
}
}
/*if((array_key_exists("username", $HTTP_COOKIE_VARS)) && (array_key_exists("password", $HTTP_COOKIE_VARS))) {
}
else {
exit;
}*/
if ($HTTP_COOKIE_VARSї'username'] == FALSE) {
displayLogin();
exit;
}Code: Select all
<?php
// ----------------------------- //
// Installer For InvasionID //
// Written By: Matt Moyles //
// -------------------------- //
require("./global.php");
$page = new HtmlTemplate("templates/content.inc");
if ($HTTP_GET_VARSї'action'] == "") {
include("templates/frameset.inc");
}
if ($HTTP_GET_VARSї'action'] == "top") {
include("templates/top.inc");
}
if ($HTTP_GET_VARSї'action'] == "nav") {
include("templates/nav.inc");
}
if ($HTTP_GET_VARSї'action'] == "main") {
$content = getContentFile("templates/main.inc");
}
$page->SetParameter("PAGE_CONTENT", $content);
$page->CreatePage();
unset($page);
?>Code: Select all
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Login To CP</title>
<base target="_self">
<style type="text/css">
td { font-family: "Verdana"; font-size: 12px; text-align: left color: #202931; }
p { font-family: "Verdana"; font-size: 12px; }
a:link {COLOR: #374A57; TEXT-DECORATION: none; font-family: "Verdana"; }
a:visited {COLOR: #374A57; TEXT-DECORATION: none; }
a:hover {COLOR: #F7CB19; BACKGROUND-COLOR: #202931; }
a:active {COLOR: #F7CB19; BACKGROUND-COLOR: #202931; }
FORM {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; FONT-SIZE: 10px; }
SELECT {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; COLOR: #51485F; FONT-SIZE: 10px; }
INPUT {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; COLOR: #51485F; FONT-SIZE: 10px; }
TEXTAREA {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; COLOR: #51485F; FONT-SIZE: 10px; }
.tbl_caption { background-color: #425766; color: #F7CB19; font-size: 9px; font-weight : bold; }
.tbl_border { background-color: #425766; }
.tbl_light { background-color: #CACFC8; }
.tbl_dark { background-color: #C0C7BD; }
.button { background-color: #425766; color: #F7CB19; font-size: 9px; font-weight : bold; }
</style>
</head>
<body bgcolor="#C1C7BF" topmargin="10" leftmargin="10">
<form action="index.php?action=checklogin" method="post">
<p align="center"><b><font color="#F7CB19">
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" border="1" class="tbl_border" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td>
<div align="center">
<center>
<table cellpadding="4" cellspacing="0" border="0" width="439" height="62" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class="tbl_caption" colspan="2" height="12" width="873">
<font style="font-size: 7pt">Login To
Saiyan Invasion Site Control Panel</font></td>
</tr>
<tr class="tbl_light">
<td height="18" width="589"><span style="font-size: 8pt">Username</span></td>
<td width="276" height="18">
<input type="text" size="28" name="username"></td>
</tr>
<tr class="tbl_dark">
<td height="18" width="589"><span style="font-size: 8pt">Password</span></td>
<td width="276" height="18">
<input type="password" size="28" name="password"></td>
</tr>
<tr>
<td class="tbl_light" colspan="2" align="center" height="1" width="873">
<input type="submit" value="Login" class="button" name="Login"></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>