My admin script will not work inside my main website script however it works everywhere else and by not work i mean it keeps asking me to login and refuses to set cookie
index.php
<?php
$sitetitle = "BL-Networks.com";
if (isset($HTTP_GET_VARS['page'])){
$thepage = $HTTP_GET_VARS['page'];
}
if (!isset($HTTP_GET_VARS['page'])){
$thepage = "DEFAULT";
}
if ($thepage == "DEFAULT"){
$pagetitle = "Premimum for Innovation in Information Technology Services";
$pagemenu = file_get_contents("./menus/default.mnu");
$pagecontent = "./common/default.pag";
}
if ($thepage != "DEFAULT"){
if (file_exists("./menus/".$thepage.".mnu")){
$pagemenu = file_get_contents("./menus/".$thepage.".mnu");
}
if (!file_exists("./menus/".$thepage.".mnu")){
$pagemenu = file_get_contents("./menus/default.mnu");
}
$pagetitle = $thepage;
$pagecontent = "./".$thepage."/index.php";
$moduledir = "./".$thepage."/";
}
if (!isset($HTTP_GET_VARS['tmp'])){
$template = file_get_contents("./default.tmp");
}
if (isset($HTTP_GET_VARS['tmp'])){
$template = file_get_contents("./".$HTTP_GET_VARS['tmp'].".tmp");
}
$pretitle = explode ("<SITETITLE>", $template);
$premenu = explode ("<SITEMENU>", $pretitle[1]);
$prebody = explode ("<SITECONTENT>", $premenu[1]);
echo $pretitle[0];
echo $sitetitle." - ".$pagetitle;
echo $premenu[0];
echo $pagemenu;
echo $prebody[0];
include ($pagecontent);
echo $prebody[1];
?>
adminpage also named index.php but in the admin dir
<?php
if (file_exists("./adminconf.php")){
include ("./adminconf.php");
if ((isset($_COOKIE['loggedin'])) && ($_COOKIE['loggedin'] == $AdminUsername)){
$myfullurl = $PHP_SELF."?".$_SERVER['QUERY_STRING'];
if (isset($HTTP_GET_VARS['adminpg'])){
$theadminpg = $admindir.$HTTP_GET_VARS['adminpg'].".php";
if (file_exists($theadminpg)){
include ($theadminpg);
}
if (!file_exists($theadminpg)){
echo "This is an invalid Admin page please use the back button on your browser";
}
}
}
if ((!isset($_COOKIE['loggedin'])) or ($_COOKIE['loggedin'] != $AdminUsername)){
if ((isset($_POST['username'])) && (isset($_POST['password']))){
if (($_POST['username'] == $AdminUsername) && ($_POST['password'] == $AdminPassword)){
setcookie("loggedin", $AdminUsername);
echo "click <a href=".$myfullurl.">here</a> to refresh";
}
if (($_POST['username'] != $AdminUsername) or ($_POST['password'] != $AdminPassword)){
echo "Wrong Password!";
}
}
if ((!isset($_POST['username'])) && (!isset($_POST['password']))){
echo "<form method=POST action=".$myfullurl.">".
"<p>Login Form</p>".
"<p>Username : <input type=text name=\"username\" size=20></p>".
"<p>Password : <input type=password name=\"password\" size=20></p>".
"<p><input type=submit value=Submit name=B1><input type=reset value=Reset name=B2></p>".
"</form>";
}
}
}
if (!file_exists("./adminconf.php")){
if ((!isset($_POST['AdminUsername'])) && (!isset($_POST['AdminPassword'])) && (!isset($_POST['AdminScriptDir']))){
echo "<form method=POST action=".$myfullurl.">\r\n".
"Admin Panel Setup<br>\r\n".
"<br>\r\n".
"Admin Username:<br>\r\n".
"<input type=text name=\"AdminUsername\" size=20><br>\r\n".
"Admin Password:<br>\r\n".
"<input type=text name=\"AdminPassword\" size=20><br>\r\n".
"Path to Admin Directory (e.g. ./home/admin/)<br>\r\n".
"<input type=text name=AdminScriptDir size=20><br>\r\n".
"<input type=submit value=Submit name=B1><input type=reset value=Reset name=B2><br>\r\n".
"</form>\r\n";
}
if ((isset($_POST['AdminUsername'])) && (isset($_POST['AdminPassword'])) && (isset($_POST['AdminScriptDir']))){
$fp = fopen("./adminconf.php", "a+");
fwrite($fp, "<?php\r\n");
fwrite($fp, "$" . "AdminUsername = \"".$_POST['AdminUsername']."\";\r\n");
fwrite($fp, "$" . "AdminPassword = \"".$_POST['AdminPassword']."\";\r\n");
fwrite($fp, "$" . "admindir = \"".$_POST['AdminScriptDir']."\";\r\n");
fwrite($fp, "$" . "includesdir = \"includes/\";\r\n");
fwrite($fp, "?>\r\n");
fclose($fp);
echo "<br><center>the Admin module has been installed Sucessfully!<br>\r\n";
echo "Please click the refresh button on your browser to continue</center><br>\r\n";
}
}
?>
I've tried using a file differencing utility but it just does'nt show any similarities between variables. Plz help soon b4 I pickAxe my computer:evilgrin: