Jump to content

$_SESSION problem


hinz

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


Link to comment
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.
Link to comment
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..
Link to comment
Share on other sites

  • 8 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.