PDA

View Full Version : login.php grrrrrrrrrrrr


PARA
07-13-2002, 11:38 PM
hihi, im having this problem with my login script, i found a few errors in it which ive managed to sort out, but now when i try to login i get greeted with this error Parse error: parse error, unexpected $ in /usr/home/urbanregress/public_html/league/login.php on line 160
Pleaseeeeeeeee can someone help me try and work out where im going wrong ... to view the srcipt click here
login.php (http://www.urbanregression.com/user/para/login.txt) ... Obviously the real script is in .php format i have just copied it and placed it in .txt for easy viewing.

PARA
07-14-2002, 02:21 AM
After quite abit of digging i found the problem to be in here somewhere,

function cookie_crisp($cname, $cvalue, $ccode, $cexpire){
global $timeout;

if(($cname) && ($cvalue)){
setcookie("$cname");
if($ccode){
$cvalue=base64_encode($cvalue);
}
if(!$cexpire){
$cexpire=(time()+$timeout[cookie]);
}
if($cexpire=="never"){
$cexpire=(time()+60*60*24*365);
}
if($cexpire=="session"){
$cexpire="";
}
$cpath="/";
$cdomain="";
setcookie("$cname","$cvalue","$cexpire","$cpath","$cdomain");
}

i no longer get any kind of error, but my problem now is that i cant seem to login, prolly coz this part is to do with the cookies but i cant see where i gotta fit the } into pleaseeeeee help:confused:

firepages
07-14-2002, 04:37 AM
your code above is missing a trailing '}' so the last line should be '}}'

as to whether that solves the cookie setting problem its hard to say!

Socraties
07-16-2002, 07:58 PM
I have run into many many cookie issues, especially when it comes to cookie setting in a function what I have found to work really well is using this in my code:


ob_start();

setcookie("cookie");

ob_end_flush();

what the ob_start(); does is stop the execution of all headers and essentially puts the code that follows it as the first code to execute. Since cookies are supposed to be the put before any other code, and I know sometimes you can't do that, this works nicely. The ob_end_flush(); obviously ends the ob_start();

I hope this helps you or others with these kinds of issues.