almightyegg Posted April 4, 2007 Share Posted April 4, 2007 I changed this whole page today and I am currently streaming through all pages making them all cookies rather than sessions, but for some reason this page won't work: <? include 'db.php'; // Connect to DB $email = $_COOKIE['email']; $password = $_COOKIE['password']; if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; include '/index.php'; exit(); } $sql = mysql_query("SELECT * FROM users WHERE email='$email' AND password='$password' AND activated='1'"); $mem = mysql_fetch_array($sql); $link = mysql_query("SELECT * FROM links") or die(mysql_error()); $qlink = mysql_fetch_array($link); $que = mysql_query("SELECT * FROM quests") or die(mysql_error()); $quest = mysql_fetch_array($que); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="default.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Account Settings</title> </head> <body bgcolor=black> <center> <? include 'links.php'; ?> </center> <table border=0 width=100% cellpadding=15> <td width=150 valign=top> <? include 'panel.php'; ?> </td> <td valign=top> <? if(!$step){ ?> General Settings<br> <a href="<? echo "$_SERVER['PHP_SELF']?step=1"; ?>">Webspace Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=2"; ?>">Message Board Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=3"; ?>">Account Attributes</a> <? }elseif($step == "1"){ ?> <a href="<? echo "$_SERVER['PHP_SELF']?step=0"; ?>">General Settings</a><br> Webspace Settings<br> <a href="<? echo "$_SERVER['PHP_SELF']?step=2"; ?>">Message Board Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=3"; ?>">Account Attributes</a> <? }elseif($step == "2"){ ?> <a href="<? echo "$_SERVER['PHP_SELF']?step=0"; ?>">General Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=1"; ?>">Webspace Settings</a><br> Message Board Settings<br> <a href="<? echo "$_SERVER['PHP_SELF']?step=3"; ?>">Account Attributes</a> <? }elseif($step == "3"){ ?> <a href="<? echo "$_SERVER['PHP_SELF']?step=0"; ?>">General Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=1"; ?>">Webspace Settings</a><br> <a href="<? echo "$_SERVER['PHP_SELF']?step=2"; ?>">Message Board Settings</a><br> Account Attributes <? } </td> </table> <center> <? include 'links.php'; ?> </center> </body> </html> It stops here: if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; include '/index.php'; exit(); because it brings up that error page and says Please enter ALL of the information! Quote Link to comment Share on other sites More sharing options...
only one Posted April 4, 2007 Share Posted April 4, 2007 if($email==NULL|$password==NULL){ Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 4, 2007 Author Share Posted April 4, 2007 Didn't work...plus all my other pages are fine with what I originally had, it's just this page... Quote Link to comment Share on other sites More sharing options...
only one Posted April 4, 2007 Share Posted April 4, 2007 at the bottom of the page <? } </td> </table> <center> <? include 'links.php'; ?> </center> </body> </html> you open a tag, and dont close it.. Quote Link to comment Share on other sites More sharing options...
only one Posted April 4, 2007 Share Posted April 4, 2007 and if you havent already realised, exit(); or die(); both terminate the rest of the page Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 4, 2007 Author Share Posted April 4, 2007 at the bottom of the page <? } </td> </table> <center> <? include 'links.php'; ?> </center> </body> </html> you open a tag, and dont close it.. Even with it closed it shows same problems... and if you havent already realised, exit(); or die(); both terminate the rest of the page It is meant to, if there is an error, the page they are tryin to access is members only so it terminates that page and brngs up the home page... Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 4, 2007 Author Share Posted April 4, 2007 I'll show you code from pages that work and page(s) that don't.. Pages that do: <? include 'db.php'; $email = $_COOKIE['email']; $password = $_COOKIE['password']; if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; include 'index.php'; exit(); } Pages that don't: <? include 'db.php'; // Connect to DB $email = $_COOKIE['email']; $password = $_COOKIE['password']; if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; include '/index.php'; exit(); } Quote Link to comment Share on other sites More sharing options...
only one Posted April 4, 2007 Share Posted April 4, 2007 <?php include 'db.php'; $email = $_COOKIE['email']; $password = $_COOKIE['password']; if((!$email) || (!$password)){ echo "Please enter ALL of the information! <br />"; header("location: index.php"); } ?> try using a header, then see what happens Quote Link to comment Share on other sites More sharing options...
almightyegg Posted April 4, 2007 Author Share Posted April 4, 2007 it's working! whoop! Don't know why that would make it work but cheers mate Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.