Jump to content

Archived

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

hinz

$_SESSION problem

Recommended Posts

Someone pls help me!!

something wrong with my session.

here is the simple code from internet.



<?php
// page1.php

session_start();


echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = cat;
/*$_SESSION['time'] = time();*/

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>




<?php
// page2.php

session_start();

echo 'Welcome to page #2<br />';

echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
/*echo date('Y m d H:i:s', $_SESSION['time']);*/

if(isset($_SESSION['username']))
return $_SESSION['username'];

else

// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>


this is the result after I press the link in page1.php.


case 1

Welcome to page #2
1970 01 01 00:00:00
page 1


this is the result after I press the link in page1.php with session id.


case 2

Welcome to page #2
greencat2006 05 17 12:55:33
page 1


y my session cannot display in case 1 in IE ?
It work fine in the case 2 using IE.
If I use OPERA to test it, it work fine for both cases.
pls help me.....:)


Share this post


Link to post
Share on other sites
Make sure you have cookies enabled in the browsers you're testing with and have no extensions that block cookies. Also, make sure that any third party software like network security isn't blocking sessions.

Take a look at our session troubleshooting guide:
[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=31047&view=findpost&p=157705\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=157705[/a]

Read ALL items in the list. Try just the simple code script in item #10.

Share this post


Link to post
Share on other sites
[!--quoteo(post=374661:date=May 17 2006, 09:35 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 17 2006, 09:35 AM) [snapback]374661[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Make sure you have cookies enabled in the browsers you're testing with and have no extensions that block cookies. Also, make sure that any third party software like network security isn't blocking sessions.

Take a look at our session troubleshooting guide:
[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=31047&view=findpost&p=157705\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=157705[/a]

Read ALL items in the list. Try just the simple code script in item #10.
[/quote]


Thanks a lot.. i found the answer!! it just a php.ini setting problem..

Share this post


Link to post
Share on other sites
I have the same problem. Can you give me the right link to the session troubleshooting guide. The one in the message never work. Also can you give me what you change in the php.ini.

Thank you

Share this post


Link to post
Share on other sites

×

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.