|
-
Oct 14th, 2002, 10:21 AM
#1
Thread Starter
Frenzied Member
Cookies === Arghhhh *Fixed*
OK,
After god knows how many problems i got, writing my "Exchange" purely from scratch,
I decided i WOULD use php-nuke as a "Base" Application,
Hacked it as i needed it, ETC,
But that aint my problem, i got it all working, SO FAR,
EXCEPT COOKIES!
I put this:
PHP Code:
if ($_COOKIE['referer']==""){
if($ref !=""){
setcookie("referer",$ref,time()+7200);
$refer=$ref;
}
} else {
$refer=$_COOKIE['referer'];
}
Into my header.php (Very top of the file),
And if i call my page like:
http://adz.ods.org:88/modules.php?na...&ref=wpearsall
It will set the cookie, etc properly, even when u go from the page, and back to it, it stays in the browser
(well for 2 hours, plenty of time for some1 to sign up i think huh)
However:
If i call the page via:
http://adz.ods.org:88/index.php?ref=wpearsall
IT WILL NOT SET THE COOKIE.
Now, I Dont got ANY idea why : Freaky stuff huh :
Now, i have got "register_globals" set to "On", etc, and stuff,
So im guessing its probally some STUPID mistake i've done.
Now: Most Likely i guess its i've use:
"$ref", i know theres another method, : I dont know what though : to get the post variables,
If ne 1 can help. it would be brill 
Tnx,
Wayne
Last edited by wpearsall; Oct 15th, 2002 at 08:35 PM.
Wayne
-
Oct 14th, 2002, 09:57 PM
#2
Stuck in the 80s
Try $_REQUEST['ref']
and if you're using it as a url variable, it's a get variable, not a post.
-
Oct 14th, 2002, 10:57 PM
#3
Thread Starter
Frenzied Member
Oh yeah, so it is 
Tnx
-
Oct 15th, 2002, 02:26 PM
#4
Frenzied Member
if you use this
PHP Code:
if ($_COOKIE['referer']==""){
if($ref !=""){
setcookie("referer",$ref,time()+7200);
$refer=$ref;
}
} else {
$refer=$_COOKIE['referer'];
}
the script doesn't know what ref is? even after you setcookie $ref is still empty. try this
PHP Code:
if ($_COOKIE['referer']==""){
if($_REQUEST['ref'] != ""){
setcookie("referer",$ref,time()+7200);
$refer=$ref;
}
} else {
$refer=$_COOKIE['referer'];
}
-
Oct 15th, 2002, 08:35 PM
#5
Thread Starter
Frenzied Member
I used :
PHP Code:
if ($_COOKIE['referer']==""){
if($_REQUEST['ref'] != ""){
setcookie("referer",[b]$_REQUEST['ref'][/b],time()+7200);
$refer=[b]$_REQUEST['ref'][/b];
}
} else {
$refer=$_COOKIE['referer'];
}
And it fixed it 
: Forgot to change post tho to *Fixed* *changes now*:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|