dual_alliance Posted August 8, 2006 Share Posted August 8, 2006 Well if you were one of the people that helped me with my previous thread (which l thankyou so much for helping me) [url=http://www.phpfreaks.com/forums/index.php/topic,103269.0.html]http://www.phpfreaks.com/forums/index.php/topic,103269.0.html[/url] you will know that l solved the problem. Well so l thought since l only use firefox l didn't think about IE until just then l thought l would test it and see what happens and it tells me to login again! (Before commenting you should read my previous thread to reduce duplicate ideas)Thankyou for your help it is greatly appreciated,dual_alliance(Note: I have IE to allow all cookies but l'm using sessions so l don't see the problem. Also l thought it could of been my IE so l asked a friend to test it in IE and she got the same problem...) Quote Link to comment Share on other sites More sharing options...
SharkBait Posted August 8, 2006 Share Posted August 8, 2006 Is it not seeing the session at all or is the session variables empty?I like to use: [code]<?php if(isset($_SESSION['username'])) { echo "You're username is: {$_SESSION['username']}\n";} else { echo "You are not logged in";}?>[/code]You could also try outputting the $_SESSION:[code]<?phpprint_f($_SESSION);?>[/code]That way it will show you what is set for the session :) Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 FireFox and Internet Explorer will generate different sessions server side I think... Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 8, 2006 Share Posted August 8, 2006 Here is something about IEIE does not refresh the page on every visit, it is a painEither press CTRL + F5, to refresh and reload the dataORto stop this all the time in IEclickTools -> Internet Options ->Settings (located middle right)4 Radio buttons will appear, Default is AutomaticlyBest working should be Every visit to the page (top one)I am going by memory here, cos I cant be bothered to open IE, so excuse minor mistakes Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 8, 2006 Author Share Posted August 8, 2006 [quote author=SharkBait link=topic=103493.msg412081#msg412081 date=1155076490]Is it not seeing the session at all or is the session variables empty?I like to use: [code]<?php if(isset($_SESSION['username'])) { echo "You're username is: {$_SESSION['username']}\n";} else { echo "You are not logged in";}?>[/code]You could also try outputting the $_SESSION:[code]<?phpprint_f($_SESSION);?>[/code]That way it will show you what is set for the session :)[/quote]Yea kingarthur (sorry if spelt incorrectly) advised me to do that, and l have it on every page[code]Array ( [userid] => 8 [username] => dual_alliance [password] => 0926274431b9d947d6b903f61c***** )[/code]And it transfers to the next page when l am using firefox... Also when l log in with IE on the first page it shows that also however when l click any link it asks me to login again.[quote author=onlyican link=topic=103493.msg412097#msg412097 date=1155077453]Here is something about IEIE does not refresh the page on every visit, it is a painEither press CTRL + F5, to refresh and reload the dataORto stop this all the time in IEclickTools -> Internet Options ->Settings (located middle right)4 Radio buttons will appear, Default is AutomaticlyBest working should be Every visit to the page (top one)I am going by memory here, cos I cant be bothered to open IE, so excuse minor mistakes[/quote]Well l could always write a tutorial for people who will be logging in and having a problem... but shorley this cant be the problem.When l use print_f($_SESSION) before exit() on the next page in IE it shows [code]Array ( )[/code] so the session must be getting killed once l click on to a next page. Why though? Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 I always use meta tags to refresh pages that I write that handle processing post variables... And the meta tags work fine in FF and IE for me... Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 8, 2006 Author Share Posted August 8, 2006 Well the first page that l login in on IE it shows the session arrary, l refresh the page again works fine. Click a link and the session dies... Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 8, 2006 Share Posted August 8, 2006 Try it, I dont know cos I always use FF, and check with IE, with the setting to refresh on every pageyou could put some meta tags up, which stop caching, meaning IE would have no choice but reload the page on every visit Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 8, 2006 Share Posted August 8, 2006 If you want to use sessions, you need session_start() first - on any page where you want to use sessions. [code]<?php session_start();if(isset($_SESSION['username'])) { echo "You're username is: {$_SESSION['username']}\n";} else { echo "You are not logged in";}?>[/code] Quote Link to comment Share on other sites More sharing options...
nethnet Posted August 8, 2006 Share Posted August 8, 2006 Since it works in FF and not IE, I'm assuming you initiate the session properly, but in that case it's probably the cache. You can adjust this with headers (because as someone mentioned, IE likes to cache pages... good for bandwidth, bad for you). Try adding this to your header:[code]header("Cache-control: private");[/code]That will force the page to reload, instead of using the cached version. Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 8, 2006 Author Share Posted August 8, 2006 I have that on every page.....I modified my code around hoping that this might work, also using the META tag idea.[code=php:0]<?phpsession_start();header("Cache-control: private");<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Pragma" content="no-cache;></head><body><?php// Is the user logged in?if (!isset($_SESSION['username'])) { echo "You aren't logged in."; include("index.php"); exit();}else{include('db.php');[/code]No luck :(, l have also tried removing:[code=php:0]header("Cache-control: private");[/code]No luck their either...I'm going to sleep since its 12:30am here. I'll worry about this in the morning Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 9, 2006 Author Share Posted August 9, 2006 Any ideas? Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted August 9, 2006 Author Share Posted August 9, 2006 bump Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 9, 2006 Share Posted August 9, 2006 Hello<meta http-equiv="Pragma" content="no-cache;>You not ending this properly<meta http-equiv="Pragma" content="no-cache"> (end with " not ;)This could create problems Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.