riverdiggidy Posted December 20, 2011 Share Posted December 20, 2011 I am createing a simply quiz site, where in order to participate in the quiz, you must first be logged in. While working on my local machine, the code works perfectly. I use the followin to create a session ID; $_SESSION['SESS_ID'] = $member['id']; Then, on my main page where i want dynamic code i include the following; if(!isset($_SESSION['SESS_ID']) || (trim($_SESSION['SESS_ID']) == '')) { print (" <div style='float:left; width:400px; height:215px; margin-left:500px;'> <form class='login' method='post' action='login-form.php' style='float:right; margin-top:120px;' > <input type='submit' class='button' name='submit' value='Sign In' style='float:right ; margin-right:20px;'> </form> <p style=' margin-top:170px; margin-left:160px;'>New Member? Start <a href='register-form.php'>Here</a></p> </div> " ); } else { print "<h4 style='float:right; text-align: right; margin-top:150px; margin-right:50px;'>Welcome ". $_SESSION['SESS_NAME']. " <a href='logout.php' style='float:right; text-align:right;'>Sign Out</a></h4> "; For some reason, when the site is on the server, the session ID does not seam to get passed along. Any Ideas how to remediy this? the website is kingdomquiz.com if anybody is interested. Quote Link to comment https://forums.phpfreaks.com/topic/253576-php-member-login-session-issue/ Share on other sites More sharing options...
m3bik Posted December 21, 2011 Share Posted December 21, 2011 Did you include session_start(); at the beginning of your script? http://php.net/manual/en/function.session-start.php Quote Link to comment https://forums.phpfreaks.com/topic/253576-php-member-login-session-issue/#findComment-1299941 Share on other sites More sharing options...
shankarganesh Posted December 21, 2011 Share Posted December 21, 2011 Hi, Please paste the output of all the session values by using below code, echo "<pre>"; print_r($_POST['$_SESSION']); and did you get the output for $_SESSION['SESS_NAME']? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/253576-php-member-login-session-issue/#findComment-1300035 Share on other sites More sharing options...
PFMaBiSmAd Posted December 21, 2011 Share Posted December 21, 2011 You likely have a php.ini configuration difference between your development system and the live server or a problem with the session configuration on the live server. Do you have php's error_reporting set to E_ALL and display_errors set to ON (temporarily) on the live server so that any php detected errors will be reported and displayed to help point out problems that are occurring? Have sessions ever worked on the live server or not just for the the code you are trying now? Quote Link to comment https://forums.phpfreaks.com/topic/253576-php-member-login-session-issue/#findComment-1300092 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.