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! Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/ Share on other sites More sharing options...
only one Posted April 4, 2007 Share Posted April 4, 2007 if($email==NULL|$password==NULL){ Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221222 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... Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221236 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.. Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221240 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 Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221241 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... Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221251 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(); } Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221281 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 Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221283 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 Link to comment https://forums.phpfreaks.com/topic/45559-solved-mang-the-change-from-sessions-to-cookies/#findComment-221288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.