php link array+cookie

golk75

Regular Member
Joined
Jul 25, 2010
Messages
240
Reaction score
26
I need to be able to have a link that can tell if it has already been clicked and if it has it needs to load a different link from an array of links, if this possible at all?
 
For each visitor individually, or once it's clicked by anyone it changes parmanently for everyone?
This is for each individually:

<?php
if (!isset($_COOKIE["clicked"])) {echo $link1;}
else {echo $link2;}
?>

Also you need to create that cookie the the link is clicked, if the link points to a php script then you can use the script to create a cookie

<?php
setcookie('clicked', '1', time() + 43200);
?>

if not, you are gonna have to use javascript directly triggered by clicking (onlick) that link.
 
you can use any id from username and password if you have & then store it in mysql database

if you don't have any id then Cookie will be good.
 
thanks guys I will start trying to put this code together.
and yes it will be for each visitor individually
 
Back
Top