I have a script that send user to another url everytime he click (first click - first url, secound cluck - secound url etc.)
Here is the script:
<?php
function urlredirect()
{
$value=0;
$url =array(
'http://www.link1.com/',
'http://www.link2.com/',
'http://www.link3.com/',
'http://www.link4.com/',
'http://www.link5.com/',
);
$urlc = count($url)-1;
if ($_COOKIE["cooki_name"]=='')
{
setcookie("cooki_name", $value,time()+86400);
header ("Location: $url[$value]");
}
if ($_COOKIE["cooki_name"]!='')
{
$getcookie=htmlspecialchars($_COOKIE["cooki_name"]);
if($urlc >$getcookie)
{
$getcookie=$getcookie+1;
}
setcookie("cooki_name", $getcookie,time()+86400);
header ("Location: $url[$getcookie]");
}
}
urlredirect();
?>
Now I need to add some echo and I do not know the right syntax. Echo from get:
script.php?code=something
<?php
function urlredirect()
{
$value=0;
$url =array(
'http://www.link1.com/HERE-IS-THE-PLACE-WHERE-I-NEED-TO-ADD-code',
'http://www.link2.com/',
'http://www.link3.com/',
....
I was trying to add it by echo $_GET["code"]; but I fail.