Q695 Posted February 8, 2009 Share Posted February 8, 2009 Why isn't this able to start, and register a php session? <?php session_start(); session_register($id); $id = $_SESSION[id]; //check to see if the user is logged in this will be done each time on any internal page ?> Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/ Share on other sites More sharing options...
Q695 Posted February 8, 2009 Author Share Posted February 8, 2009 It does work on a WAMP server, just not a Lunar Pages server. Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-757604 Share on other sites More sharing options...
wildteen88 Posted February 8, 2009 Share Posted February 8, 2009 session_register and its counter part session_is_registered are depreciated. you should be using the newer $_SESSION superglobal variable. file1.php <?php session_start() // add a new item to the session array. $_SESSION['data'] = 'hello there'; ?> <a href="file2.php">Retrieve session</a> file2.php <?php session_start() // retrieve the data item from the session array echo $_SESSION['data']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-757606 Share on other sites More sharing options...
Q695 Posted February 9, 2009 Author Share Posted February 9, 2009 No, that didn't work: http://sd52gop.internetkeep.net/test/session.php Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-757814 Share on other sites More sharing options...
Q695 Posted February 9, 2009 Author Share Posted February 9, 2009 page source: <?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title></title> </head> <body> <?php if ($_GET[action]){ // retrieve the data item from the session array echo $_SESSION['data']; } else { // add a new item to the session array. $_SESSION['data'] = 'hello there'; ?> <a href="?action=1">Retrieve session</a> <?php } ?> </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-757816 Share on other sites More sharing options...
wildteen88 Posted February 9, 2009 Share Posted February 9, 2009 The file you linked to here: http://sd52gop.internetkeep.net/test/session.php is displaying what is known as the BOM character save session.php as ASCII (or UTF-8 without BOM) and sessions will work as normal. Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-758299 Share on other sites More sharing options...
Q695 Posted February 9, 2009 Author Share Posted February 9, 2009 Thanks, is there an applet that can check for those characters on your pages when tings aren't working right? Quote Link to comment https://forums.phpfreaks.com/topic/144379-lunar-pages-session_start-bug/#findComment-758354 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.