I need help about php sessions on apache for windows 2000

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roldan
Forum Newbie
Posts: 1
Joined: Tue Sep 17, 2002 11:38 am
Location: Cuba
Contact:

I need help about php sessions on apache for windows 2000

Post 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
codewarrior
Forum Commoner
Posts: 81
Joined: Wed Aug 07, 2002 1:28 pm

Post by codewarrior »

User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

have you configured the PHP?
User avatar
chiefmonkey
Forum Commoner
Posts: 25
Joined: Sat Apr 20, 2002 5:21 am
Location: Glasgow UK

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply