corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Bloomin' Cookies


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Bloomin' Cookies
ed
Member

Registered: 10th Sep 03
User status: Offline
13th Nov 07 at 12:14   View User's Profile U2U Member Reply With Quote

Decided to have another go at cookies but they just don't work at all for me

On one page I have this section of script:

code:

case 1:
$target="../index.php";
setcookie("user", "$userID", time()+3600);
setcookie("pass", "$checkPass", time()+3600);
include('forward.php');
break;



Which works as I can see the set cookie in Firefox... But on the next page I have this to start with to check and make sure it works:


code:

$user=$_COOKIE["user"];
$pass=$_COOKIE["pass"];

echo $user;
echo $pass;



Of which I am not getting output from at all.

Would the fact that I am locally testing this script using Vertrigoserv cause any problems? I have read so many things on the web and I can't seem to find the problem
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
13th Nov 07 at 12:27   View Garage View User's Profile U2U Member Reply With Quote

how does it know what cookie its looking for?
ed
Member

Registered: 10th Sep 03
User status: Offline
13th Nov 07 at 12:36   View User's Profile U2U Member Reply With Quote

Surely $_COOKIE["pass"]; is telling it to look for the cookie that was set using setcookie("pass", "$checkPass", time()+3600);?
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
13th Nov 07 at 12:39   View Garage View User's Profile U2U Member Reply With Quote

what happens if you do

print_r($_COOKIE);
Richie
Member

Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
13th Nov 07 at 12:39   View User's Profile U2U Member Reply With Quote

http://www.cookiecentral.com/
_Allan_
Member

Registered: 24th Mar 04
User status: Offline
13th Nov 07 at 12:43   View User's Profile U2U Member Reply With Quote

mmm subway cookies, 3 for £1.
Ash_EP3
Member

Registered: 15th May 07
Location: Melksham, Wiltshire
User status: Offline
13th Nov 07 at 13:17   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by _Allan_
mmm subway cookies, 3 for £1.


ed
Member

Registered: 10th Sep 03
User status: Offline
13th Nov 07 at 15:57   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by Steve
what happens if you do

print_r($_COOKIE);

Returns Array()
Laney
Member

Registered: 6th May 03
Location: Leeds
User status: Offline
13th Nov 07 at 16:02   View User's Profile U2U Member Reply With Quote

Do you need to use the cookie equivalent of session_start(); ?

[Edited on 13-11-2007 by Laney]
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
13th Nov 07 at 16:03   View Garage View User's Profile U2U Member Reply With Quote

id say its your server or browser privacy settings
ed
Member

Registered: 10th Sep 03
User status: Offline
13th Nov 07 at 16:12   View User's Profile U2U Member Reply With Quote

I finally figured it out, it's been pissing me off for ages. Basically I needed to set the default domain for where the cookie is available by doing this:

setcookie("user", "$userID", time()+3600, "/");

That makes the cookie available for the whole site which is what I need because I have everything neatly stored in folders for easy human access...
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
13th Nov 07 at 16:15   View Garage View User's Profile U2U Member Reply With Quote

aye, thought it was something to do with it not knowing where the cookie was
Laney
Member

Registered: 6th May 03
Location: Leeds
User status: Offline
13th Nov 07 at 16:20   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by ed
I finally figured it out, it's been pissing me off for ages. Basically I needed to set the default domain for where the cookie is available by doing this:

setcookie("user", "$userID", time()+3600, "/");

That makes the cookie available for the whole site which is what I need because I have everything neatly stored in folders for easy human access...


So "/" stopped it working?

Typical
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
13th Nov 07 at 16:21   View Garage View User's Profile U2U Member Reply With Quote

no that just means it looks for anything after the domain name

[Edited on 13-11-2007 by Steve]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Why Can't I log in at home? jaffa General Chat 6 308
27th Feb 03 at 11:48
by jaffa
 
Ice Cream Shelly General Chat 11 173
1st Apr 03 at 13:10
by pinky ;)
 
Once again i'm stuck in the world of Corsasport.......... Andy Stocker General Chat 14 331
13th May 03 at 21:57
by kinkycorsa
 

Corsa Sport » Message Board » Off Day » Geek Day » Bloomin' Cookies 29 database queries in 0.1040940 seconds