473,595 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

session_set_coo kie_params and session_save_pa th

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

So if I do

session_save_pa th("/blah/blah/")

it saves my sessions to that path.

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

it breaks session_start.

however

session_set_coo kie_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 2275
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_p ath("/blah/blah/")

it saves my sessions to that path.

but if I follow it by
session_set_co okie_params(nnn n, "/blah/blah/")

it breaks session_start.
You've possibly misunderstood the "path" parameter on
session_set_coo kie_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.u k :: 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_pa th("/blah/blah/")
Session data is saved to /blah/blah
it saves my sessions to that path.

but if I follow it by
session_set_coo kie_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_coo kie_params(nnnn );
Unless you changed `session.cookie _path` in php.ini, this is the
same as

session_set_coo kie_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_coo kie_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
4315
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 /home/rfresh/public_html/whosonline_form.php on line 93 This is line 93 in the function below: if (time()- fileatime(session_save_path() . '\\' . $file) <
19
11141
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 it doesn't recognise the user. I've used Session_Start() which I thought was meant to maintain the session variables between pages but it doesn't do work. Any ideas or FAQ's?
6
2119
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 php.ini file I have this line, which I guess will give me a 365 days timeout on my PHPSESSID server session:
0
955
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 see if there is a session variable called uid (user id). If there is, it verifies that it is still valid otherwise it will unset it. Now when a user tries to login the script destroys the old session (including the cookie, which expires when the...
3
4954
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'); } else { session_set_cookie_params(7200, '/', '.domain.com'); } Thanks
21
3050
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 computers (running different browsers, logged in as different users, etc.). My web site keeps track of users logged in through the use of $_SESSION. Here's the bizarre thing: All computers are logged off, then I log into my web site with one...
1
1238
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", i.e. navigation from one page to another can result in the session being reset. Here is what appears at the top of all my files. ==============
7
55891
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 user not accessing any event form the past 15 min then i will redirect this gallery page to password.php.
2
1414
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 and access the same file in the PHP session_save_path (/tmp/ sess_c2b09aac9b607b1df05d73c7f1c4cbb1). If I delete that file, the whichever app runs first, saves data under that filename and the other will fail. They both keep regenerating the...
0
7883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8019
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6674
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3873
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2391
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1490
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.