Can any please shead some light on to why I might be getting the following errors.
I'm using the following function.
<?php
// Standard shopping cart functions
function readcart ($cid) {
global $auth, $fname,$uid,$doing,$recid;
global $validuser;
$fh = fopen("sessions/$cid","r");
while ($line = fgets($fh,1024)) {
$line = trim ($line);
$parts = split(" ",$line,2);
switch ($parts[0]) {
case "auth":
$auth = $parts[1];
break;
case "fname":
$fname = $parts[1];
break;
case "uid":
$uid = $parts[1];
break;
case "doing":
$doing = $parts[1];
break;
case "recid":
$recid = $parts[1];
break;
}
}
if ($uid > 0) $validuser = 1;
}
function writecart ($cid) {
global $auth, $fname,$uid,$doing;
$fh = fopen("sessions/$cid","w");
fputs($fh,"auth $auth\n");
fputs($fh,"fname $fname\n");
fputs($fh,"uid $uid\n");
fputs($fh,"doing $doing\n");
fputs($fh,"recid $recid\n");
}
(this function was written for me)
When I was uploaded the system I got the following error message.
Warning: fopen("sessions/H3b30778c9724e","w") - No such file or directory in stdfuncs.inc on line 37
Warning: Supplied argument is not a valid File-Handle resource in stdfuncs.inc on line 38( this warning was repeated for all lines in the case statement)
I then tried putting a ../in front of sessions on every call to the fopen function.
I now get
Warning: fopen("../sessions/","r") - Permission denied in stdfuncs.inc on line 8.
Although this message arises, data still appears to being written to the session, but whole thing is very flakey an only parts of it work.
Where could the problem lie? Could it be an apache problem, or is it in the coding of the function. I'm using phpdev3 which preconfigures apache, mysql3.23, and php4 to run on windows.
If anyone has any suggestion to waht might be causing this, please let me know.
thanks in advance
Chris