cookie question

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
humpy
Forum Newbie
Posts: 5
Joined: Sat May 29, 2004 9:27 pm

cookie question

Post by humpy »

is it possible to set a cookie only when someone clicks a link from your page to another persons page, so that you can later check there cookies to see if they have visited that link?
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

I belive it is, you just have to set a way to make the link activate the if statement of function you are using to set the cookie like this:

page.php?setcookie=yes

there might be a better way but thats how i would do it
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you could set up a redirect page, that sets the cookie, then bounces them to the real page..

[edit] something like this: not tested

sending page:

Code: Select all

...<a href="redir.php?www.google.com">
redir.php :

Code: Select all

<?php

$addr = $_SERVER['REQUEST_URI'];

set_cookie('wee','they were ''ere!');

header("Location: $addr");

?>
Post Reply