473,385 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Session expires

I have a strange problem. Having a site with multiple pages in PHP, all pages begins with this code:

[PHP]<?php session_start();

if (isset($_GET['lang'])) {
if ($_GET['lang'] == "en") $_SESSION['lang'] = "en";
if ($_GET['lang'] == "sv") $_SESSION['lang'] = "sv";
if ($_GET['lang'] == "fi") $_SESSION['lang'] = "fi";
}

if (isset($_SESSION['lang'])) {
$lang = $_SESSION['lang'];
}

?>[/PHP]

No other code refers to session* or $_SESSION - just $lang is involved.

All pages exept index.php works (ie session is preserved) but when I exit index.php the session is renewed. What can be the issue?

Thanks for any help - very appreciated! regards Joa
Apr 9 '08 #1
2 1398
ronverdonk
4,258 Expert 4TB
How do you 'exit' index.php? By closing the browser? How?
And you are sure no unset of $_SESSION=''is anywhere in your code?

If all negative, show the code from the first setting of the $_SESSION array and the script that is supposed to handle this $_SESSION['lang'] field (and does not find it).

Ronald
Apr 9 '08 #2
TheServant
1,168 Expert 1GB
Can you post some of your index code? The header part would be good.

After you have run a page, what happens when you go back to the index page? Does it work then?
Apr 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: PM | last post by:
I'm trying to make a kind of search history containing the 3 last searched words. So I'm using 3 Session Variables: Word1 / Word2 / Word3. In order to get this history working, I need to put the...
12
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the...
1
by: Jenn | last post by:
I have done alot of web work in all sorts of languages but I have never used the simple cookie. Question is How does one set and retrieve a simple session cookie. All it will do is have an image...
11
by: Jennifer | last post by:
Is there a way to check for to see if the user has session cookies enabled? I know how to check to see if they have cookies in general enabled, but how do you test for just session cookies? ...
3
by: Enoch Chan | last post by:
I would like to set a Session variable to a value. In Vbscript it should be Session("ZoomValue")=500 How can I set this session variable by using Javascript? Thanks
12
by: ACaunter | last post by:
Hi all, I was wondering how i could write some code which would automatically open the Login Page once the session has expired? -- AdamPC@hotmail.com
14
by: Martin Walke | last post by:
Hi all, Is there any limit to the number of session variables a site can have? And is that affected by global.asa at all? The reason why i ask is that i have a relatively simple site that...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
4
by: rgparkins | last post by:
Hello I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the...
0
by: Aarchaic | last post by:
Hello i have problem my session variables seem to disapear as i go along i've created this code to ilustrate whats happening First off i just post 3 detials like a name a age and a favourite...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.