Jump to content
Killersites Forums

Session code not working in Opera or Chrome


Wickham
 Share

Recommended Posts

I've used Stefan's tutorial for session code and all browsers show date time or browser information if the code is on the first page, but if the session is repeated on a second page which he calls session.php, Opera and Google Chrome do not show the date and time or browser data but IE7, Safari and Firefox do work.

 

<?php session_start(); ?> above the doctype on session.php and

 

<?php

echo "

Wickham43.net PHP page was opened on " . $_SESSION['time'] . "

";

?>

 

in the body

 

Is this a known bug with these browsers and how is it overcome?

Link to comment
Share on other sites

This test page shows the code in the main page and the code in the linked session2.php page below the horizontal rule.

 

http://w ww.wickham43.com/forumposts/phpdatetime3.php

 

The date time shows in all browsers on the same page but if you click the link to session.php you will see that Opera and Chrome do not show the date and time, so it looks like a browser problem rather than a php code problem. but it could be serious for Opera or Chrome users if their session isn't working so I wondered if there is a solution.

Link to comment
Share on other sites

I thought that might be the answer, but it isn't. I usually have cookies set as session cookies only, but Opera has more detailed cookie settings and I've tried "Accept cookies only from the site I visit" and "Accept cookies" and checked in Manage Cookies and seen that my site is listed there, but the linked page session2.php still doesn't show the date and time. I've cleared the cache and history too.

 

However, Chrome had cookies blocked (I don't use this browser much) and after unblocking cookies the date and time now show on the session2.php page, so I'll try Opera again.

 

Edit: Opera still refuses to show the date and time on session2.php even with cookies.

 

Edit2: at long last I've got Opera to work. I reset the global cookie setting and it didn't work, but then I found that I'd set my own domain names in the site specific settings to accept javascript but the cookies were still blocked, so that setting overrode the global setting to accept them. Thanks tpattison.

Edited by Wickham
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...