M.O.S. Studios Posted September 4, 2008 Share Posted September 4, 2008 here is my problem, i want to send a user to another website and have all the session data recalled when he is returned. to test this did this page 1 (loaded in one browser) <?php session_start(); echo $test=session_id(); $_SESSION['test']="HELLO"; ?> page two (loaded in another browser, with the session id number in the url manualy) <?php session_id($_GET['sid']); session_start(); echo $_SESSION['test']; ?> it works like i thought how ever i keep getting this error: (frame of ref, page two is called test1.php) Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/montrea1/public_html/test1.php:1) in /home/montrea1/public_html/test1.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/montrea1/public_html/test1.php:1) in /home/montrea1/public_html/test1.php on line 3 where is my problem? Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/ Share on other sites More sharing options...
revraz Posted September 4, 2008 Share Posted September 4, 2008 Sounds like white space up before your php code Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633924 Share on other sites More sharing options...
M.O.S. Studios Posted September 4, 2008 Author Share Posted September 4, 2008 that is what i thought but their isn't any space! its so mind boggeling? i looked it up and a website said that ihave to use a buffer to getit to work. that dosn't make scene to me because it gives me that message even if i change the script to <?php session_start(); ?> Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633933 Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 Did you save the file as UTF-8? If you did, your editor may have put in a BOM (Byte Order Mark). There should be an option to turn it off, but if not, open a hex editor and delete the characters, or just copy and paste the script into notepad and save (don't actually load it in because the BOM will still be there...). Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633936 Share on other sites More sharing options...
M.O.S. Studios Posted September 4, 2008 Author Share Posted September 4, 2008 i'll try that but i've never had a problem with that befor, also i did it in notebad and i beilive that that is not utf8 Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633940 Share on other sites More sharing options...
M.O.S. Studios Posted September 4, 2008 Author Share Posted September 4, 2008 DarkWater you where 100% right, when i started editing the second file i must have saved it in the wrong format. i all i had to do was copy it into a brandnew notepad file, resave and up load thanks again Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633956 Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 Any time. Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633958 Share on other sites More sharing options...
Mchl Posted September 4, 2008 Share Posted September 4, 2008 For future reference: Notepad++ lets you implicitly save file as UTF-8 without BOM. Link to comment https://forums.phpfreaks.com/topic/122767-solved-session_start-and-session_id/#findComment-633966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.