473,395 Members | 1,484 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,395 software developers and data experts.

Keeping the same session_id when a page is refreshed

I have the following script:

<?PHP
session_start();
echo session_id();
?>

But it gives a different session_ID() everytime the page is reloaded.
Is there any way to keep the same session_ID() until the browser window
is closed?

Jul 17 '05 #1
4 2008
There are two methods to propagate a session id: cookies & URL
parameter.

I suppose you are using the first one. The most probable cause is the
fact that you do not have cookies enabled in your browser.

Another thing might be the fact that you have not set up the
session.save_path variable in php.ini...

Clau

Jul 17 '05 #2
I have cookies enabled and I have session.save_path setup in php.ini
and it still doesn't work in either Firefox or Internet Explorer.

Jul 17 '05 #3
I`m blank then. The only times I had this problem was when
session.save_path was pointing to a bogus directory _OR_ the disk was
full/did not have write acces there. On Windows you should use single
backslashes (i.e. w:\php\sessions) with no trailing slash.

Clau

Jul 17 '05 #4

<ja****@gmail.com> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.com...
I have cookies enabled and I have session.save_path setup in php.ini
and it still doesn't work in either Firefox or Internet Explorer.


Make sure the folder in fact exists. PHP won't create it itself. And use
forward slashes in the path even when it's on Windows. That's the preferred
practice for both PHP and Apache.

Do a print_r($_COOKIE) at the end of the page to see if you're actually
receiving the cookie.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Annie | last post by:
I have a script to check if a session exists, if not then I log the user's info from $_Server variables into a database (ip address, time, etc.). The problem is that the test: ...
1
by: Ken | last post by:
Which is the correct means of transferring session_id() attached to the URL address? or do all work? I am getting inconsistence results. $sessionid = session_id(); <a href="<?PHP echo...
1
by: abdul bari | last post by:
Hi I have a standard html form which is generated by an XSL sheet. The form data is submitted to the server and is passed on to file.aspx for processing. However file.aspx is refreshed every 5...
1
by: Lenard Gunda | last post by:
Hi! I have the following problem. From my main page, when someone clicks a button, it uses client side javascript to open another .aspx page. This page displays content, based on what the...
2
by: damian.jolly | last post by:
Is persisting objects to the SESSION the best way to prevent an object from being created every time a page is refreshed? It's a bit complicated but I'll try to be brief... I am using a guage...
8
by: Michael.Guppenberger | last post by:
Hello everyone, I am currently trying to create a materialized query table which should be in-sync all the time. So my first attempt was to use the "REFRESH IMMEDIATE" option of the create table...
3
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4. I have two domains -- www.mydomain1.com and www.mydomain2.com. Both point to the same IP address. I have two pages on that IP -- first.php <?php session_start();...
3
by: Mythilisg | last post by:
hi, i'm working in asp.net with c#. i hav one dropdownlist with some options which is similar to Security Questions in yahoo mail. I hav one option called "If Others". When the user selects this...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.