jlewis85 Posted November 29, 2008 Share Posted November 29, 2008 So I been at this for the last week or so and I have been having issues trying to get my cookies to set. <?php require_once('../Config/NFM-Functions.php'); require_once('../Config/browser.php'); $user=$_POST['username']; $pass=$_POST['password']; $ErrorCode=$_REQUEST['ErrorCode']; switch ($_POST["action"]) { case Login: DB_Connection(); ob_start(); $SQLQ="SELECT * FROM `users` WHERE usern='$user'"; $SQLR=mysql_query($SQLQ)or die("I am sorry there seems to be a problem with retrieving the user's details. This is the error that is given to me: \n\n".mysql_error()."\n\n - Charlie"); while($SQLO = mysql_fetch_array($SQLR, MYSQL_ASSOC)) { if ($SQLO['pass'] = $pass) { setcookie('MYA_UID', $SQLO[uid]); setcookie('MYA_Active', "Yes"); header("Refresh: 5; url=../"); } else { header("Location: ?ErrorCode=1003"); } break; } } ?> <html> <head> <title>MYAdvantage - NFM - Home Entertainment - Log On</title> <? if ( ( browser_detection( 'browser' ) == 'msie' )) { echo "<link rel=\"stylesheet\" href=\"../CSS/home-ie.css\">"; } else { echo "<link rel=\"stylesheet\" href=\"../CSS/home.css\">"; } ?></head> <body> <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="middle"> <center> <table width="250" height="150" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="250" height="150" style="border: 2px #666666 solid; color: #4f74a1; font-weight: bold"> <center> <? switch ($_POST["action"]) { case Login: Echo "Log On Successful <BR><BR>Thank you ".$user.", for logging in. You will be redirected to the homepage.<br><br>"; echo $_COOKIE; break; default: Echo "Log into MYAdvantage"; echo "<br><BR><font color=\"red\">"; Error_Processor($ErrorCode); echo "</font>"; ShowLogon(); break; } ?> </center> </td> </tr> </table> </td> </tr> </table> </body> </html> Any ideas on what I am doing wrong? Link to comment https://forums.phpfreaks.com/topic/134713-attempting-to-set-cookies/ Share on other sites More sharing options...
dezkit Posted November 29, 2008 Share Posted November 29, 2008 So what exactly is the problem? Link to comment https://forums.phpfreaks.com/topic/134713-attempting-to-set-cookies/#findComment-701449 Share on other sites More sharing options...
jlewis85 Posted November 29, 2008 Author Share Posted November 29, 2008 ack, I knew that I forgot something else. Well its not setting the cookies for whatever reason. It thinks that the information is valid but if I were to put in a different password it still takes the request and processes it as a valid logon. Link to comment https://forums.phpfreaks.com/topic/134713-attempting-to-set-cookies/#findComment-701452 Share on other sites More sharing options...
jlewis85 Posted November 30, 2008 Author Share Posted November 30, 2008 Does anyone have any clue on what is going on? Link to comment https://forums.phpfreaks.com/topic/134713-attempting-to-set-cookies/#findComment-702044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.