Forum Moderators: coopster

Message Too Old, No Replies

How to prevent headers/cookies from being set?

remove session_start() cookies

         

BlackDex

1:13 pm on May 22, 2007 (gmt 0)

10+ Year Member



Hello there,

I need to start/close the current session ($_SESSION) because of the lock session set on the session file, which i need to be unlocked.

Anyway, currently when i use a function that looks something like this.


function setSessionVar($varname, $value) {
session_start();
$_SESSION[$varname] = $value;
session_write_close();
}

It adds a session cookie everytime the session_start() gets called.
This adds multiple cookies with the same session name, value, expire date etc.. etc..

Is there a way to prevent the cookie/header to be set or something?

Thx in advanced.

delboy1978uk

1:17 pm on May 22, 2007 (gmt 0)

10+ Year Member



i think what you would do is actually start the session from outside the function for each page where one of these variables will be set

usually this would mean at the top of your page of code

BlackDex

4:59 pm on May 22, 2007 (gmt 0)

10+ Year Member



That is true, but this will lock the session until the script is finished.

What i want is to unlock the session during the script.
This works as shown in my first post, but with multiple calls to that function, it adds more cookie headers.