Jump to content

[SOLVED] session_start and session_id


M.O.S. Studios

Recommended Posts

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

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();

?>

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...).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.