Page 1 of 1

I need help about php sessions on apache for windows 2000

Posted: Tue Sep 17, 2002 11:38 am
by roldan
i can't use sessions on my apache server over win2000 and i need to use it, somebody knows if is impossible use it?
my code looks like this but don't works on windows although on linux always was ok:

if (session_is_registered("Var1")){
$var1 = explode(";", $HTTP_SESSION_VARS["Var1"]);
$Exit1 = 0;
$Exit0 = 0;
if (isset($HTTP_GET_VARS["Action"]) && session_is_registered("Var1"){
switch ($HTTP_GET_VARS["Accion"]){
case 0:
if (in_array($HTTP_GET_VARS["Code"], $var1)){
$out = $HTTP_GET_VARS["Code"];
$str = $HTTP_SESSION_VARS["Var1"];
$pos = strpos($str, $out);
$str = substr_replace ($str, "", $pos, strlen($out));
if ($str[strlen($str)-1] == ";")
$str = substr_replace ($str, "", strlen($str)-1, 1);
if ($str[0] == ";")
$str = substr_replace ($str, "", 0, 1);
$par = strpos($str, ";;");
if ($par)
$str = substr_replace ($str, "", $par,1);
$HTTP_SESSION_VARS["Var1"] = $str;
$Exit0 = 1;
}
break;
case 1:
if (!in_array($HTTP_GET_VARS["Code"], $var1)){
if ($HTTP_SESSION_VARS["Cnt"] == 0)
$HTTP_SESSION_VARS["Var1"] = $HTTP_GET_VARS["Code"];
if ($HTTP_SESSION_VARS["Cnt"] > 0)
$HTTP_SESSION_VARS["Var1"] = $HTTP_SESSION_VARS["Var1"].";".$HTTP_GET_VARS["Code"];
$Exito1 = 1;
}
break;
}}}
if (!session_is_registered("Var1")){
session_start();
session_register("Var1");
session_register("Cnt");
$HTTP_SESSION_VARS["Var1"] = '';
$HTTP_SESSION_VARS["Cnt"] = 0;
}

so please answer me wy didn't function

Posted: Tue Sep 17, 2002 12:42 pm
by codewarrior

Posted: Tue Sep 17, 2002 3:52 pm
by Takuma
have you configured the PHP?

Posted: Tue Sep 17, 2002 4:13 pm
by chiefmonkey
Takuma wrote:have you configured the PHP?
Create a folder somewhere on you machine, call it whatevrer you want and then change the session save path php.ini file to point to this folder.

George

Posted: Wed Sep 18, 2002 4:25 am
by twigletmac
From the manual:
Caution
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister().
Try using one method or the other instead of mixing them as it causes problems.

Mac