vatzcar Posted February 14, 2007 Share Posted February 14, 2007 i'm trying to make a login session for users. now after starting session session variables are getting destroyed when i'm changing the page. my code is like this ...... // start the session session_start(); // set the session variable so we can check lated whether the user has logged in // or not $_SESSION['user_logged'] = true; // another session variable to determine which interface is to be called $_SESSION['interface_id'] = 1; // now redirect to main page $text = GenHeaderHTML(2); .... function GenHeaderHTML($processid){ // include the file which contains header HTML part include("header.php"); // if one process requested then redirect to admin page to show the interface dynamically if($processid == 1){ $pretext = "\n<BODY>\n"; }else{ $pretext = "\n<BODY onload=window.location=\"admin.php\";>\n"; } $pretext .= "<TABLE width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n"; $pretext .= "\t<TR>\n"; $pretext .= "\t <TD width=\"80%\">"; return $pretext; } when i'm not redirecting i'm getting the session variables. even i've tried to create a link to admin.php, whenever i'm using that link still those session variables are getting destroyed. what's wrong i'm doing? Link to comment https://forums.phpfreaks.com/topic/38424-session-problem/ Share on other sites More sharing options...
fert Posted February 14, 2007 Share Posted February 14, 2007 are you sure you have session_start() on the other pages? Link to comment https://forums.phpfreaks.com/topic/38424-session-problem/#findComment-184333 Share on other sites More sharing options...
vatzcar Posted February 14, 2007 Author Share Posted February 14, 2007 nope, i don't have session_start. but now i did that. thank you very much fert for your quick help Link to comment https://forums.phpfreaks.com/topic/38424-session-problem/#findComment-184340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.