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

session_set_cookie_params and session_save_path

I seem to be able to get these to work separately, but not together.

So if I do

session_save_path("/blah/blah/")

it saves my sessions to that path.

but if I follow it by
session_set_cookie_params(nnnn, "/blah/blah/")

it breaks session_start.

however

session_set_cookie_params(nnnn);
session_start();

works fine!!

Is there something I am doing wrong, or is there a workaround?
Basically, I need a system which allows a browser to sit idle for a
number of hours for what is an intranet application, but I need my
sessions stored to a specific location.

Any ideas? Thanks in advance
Oct 13 '06 #1
3 2266
On Fri, 13 Oct 2006 20:29:54 +0100, turnitup <same@samewrote:
>I seem to be able to get these to work separately, but not together.

So if I do

session_save_path("/blah/blah/")

it saves my sessions to that path.

but if I follow it by
session_set_cookie_params(nnnn, "/blah/blah/")

it breaks session_start.
You've possibly misunderstood the "path" parameter on
session_set_cookie_params - it's the URL path prefix for which the cookie
applies - corresponding to the path parameter on setcookie() - it is not the
session save path.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Oct 13 '06 #2
turnitup wrote:
if I do

session_save_path("/blah/blah/")
Session data is saved to /blah/blah
it saves my sessions to that path.

but if I follow it by
session_set_cookie_params(nnnn, "/blah/blah/")

it breaks session_start.
The client sends cookies to pages in "http://www.yourserver.com/blah/blah"
but the script where you call session_start() is not in that directory,
so it never receives a session id from the client.
however

session_set_cookie_params(nnnn);
Unless you changed `session.cookie_path` in php.ini, this is the
same as

session_set_cookie_params(nnnn, '/');
session_start();

works fine!!
The client and the server are in synch! :)
Is there something I am doing wrong, or is there a workaround?
Basically, I need a system which allows a browser to sit idle for a
number of hours for what is an intranet application, but I need my
sessions stored to a specific location.
Do not use session_set_cookie_params(), or, if you must, keep it short
and omit the 'path` parameter.

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 13 '06 #3
Thank you all for your replies. I will see how it goes.
Oct 14 '06 #4

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

Similar topics

3
by: Ralph Freshour | last post by:
I got the following function from one of the PHP websites and I'm getting the following error: Warning: fileatime(): Stat failed for /tmp\lost+found (errno=2 - No such file or directory) in...
19
by: Chris Allen | last post by:
Hi I'm new to PHP and I'm trying to create a Login Form. Once the user has logged in then he shouldn't have to log in again. The trouble is I'm getting a new session ID between every page and so...
6
by: FamB | last post by:
I have this PHP code (PHP5): if($autologin == "on") session_set_cookie_params(60*60*24*365); // 365 days else session_set_cookie_params(0); // when browser closes session_start(); In my...
0
by: Kyle Teague | last post by:
I am trying to get a proper implementation logging a user in using a DB backend. This is how I have it set up so far. session_start() is called when someone logs on to the site. It checks to...
3
by: elyob | last post by:
I want to test locally and can't get past my cookie protection, is this right? It doesn't seem to work ... if ($_SERVER=="127.0.0.1") { session_set_cookie_params(7200, '/', '.localhost'); }...
21
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different...
1
by: turnitup | last post by:
Dear All, I have a slight problem, even though I have set up a discrete session path with write access, and my session files are being set there, users still get intermittently "kicked off",...
7
by: isekhari | last post by:
hi i have a page which display all images in a floder.for accesing this page i am asking password for this. now i have 2 files named as password.php and gallery.php. now my requirement in if...
2
by: sugapablo | last post by:
I have a server where two different users are each running a different web application. I installed SugarCRM for one, and Info@Hand (built from SugarCRM) for the other. Both are trying to save...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
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...
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...

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.