Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   50/50 php traffic filter (http://www.greenguysboard.com/board/showthread.php?t=35528)

Roni20 2006-10-24 12:19 PM

50/50 php traffic filter
 
Hi

I'm looking for script which will send first clickt to address1 second click to address2 third click to address 1 etc...

I have something like this
PHP Code:

<?
$a
=rand(0,1);
if(
$a==0){
      
Header("Location: http://www.google.com");
}
   else{
     
Header("Location: http://www.yahoo.com");
}
?>

it's almost ok because here is 50% chance that will be 0 or 1, but here can be 3 times in turn 1 next can be 5 time in turn o etc. I need exactly 50/50.

Can you help ?

virgohippy 2006-10-24 03:54 PM

You could store a 0 or 1 value in a database, and have the value change every time the code executes... but that seems like a lot of resources to use up just to be in control over something like that.

Over a wide sample, random values should equal 50/50 odds. |huh

Why do you need 50/50, exactly?

Also, I'd rather have the code cycle through an array of header values, this way you can easily add more headers later. |thumb

Roni20 2006-10-25 07:48 AM

I need a filter which will send a user who clicks in link first time to LINK1 next user will send to LINK2 next user will send to LINK1 next to LINK2 ...

mOrrI 2006-10-26 05:56 AM

For this u need to record the last selection...

and then check this last selection before choosing where to send the user...

kitty_kate 2006-10-26 01:02 PM

You have to remember somehow the last selection. You could do it using a database table or textfile. I don't see other means to do it.

calmlikeabomb 2006-10-26 09:06 PM

Hey, do you want this script to operate on a per visitor basis?

Example, it rotates 50/50 between the two URLs on each individuals click(s).

OR

on a global level where each click made by ALL visitors is stored and recorded by the system and the 50/50 chance is based on all clicks being made throughout the system..

Thanks,
Levi


All times are GMT -4. The time now is 12:55 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc