help with redirect script

Started on the old forum in March 2010 · view the original in the archive · old links redirect here

2 replies · 353 views · started 16 years ago · 1 min read

2 participants
jnetwensu Junior · 35 posts #1

hi this is the script im using to redirect traffic to my other sites but it doesnt work correctly please can someone help

$rand=rand(1,10); if ($rand==1) { $link_go='http://friend1.com'; } else if ($rand==2) { $link_go='http://friendy2.com'; }

header("Location: $link_go"); ?>

CreativityKills Lead · 833 posts #2

Try this:

<?php
$gpc = rand(0,1);
switch($gpc)
{
 case "1":
 header('Location: http://siteone.com');
 break;
 default:
 header('Location: http://sitetwo.com');
 break;
}
jnetwensu Junior · 35 posts #3

also i want 10% to go to the first link another 10% to go to the 2nd link and then i want the remainder to just stay on the page.. will that allow me to do that?

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close