Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-10-24, 12:19 PM   #1
Roni20
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
Roni20's Avatar
 
Join Date: Dec 2004
Posts: 79
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 ?
Roni20 is offline   Reply With Quote
Old 2006-10-24, 03:54 PM   #2
virgohippy
Madness is like gravity. All it takes is a little... push.
 
virgohippy's Avatar
 
Join Date: Feb 2006
Location: California
Posts: 1,679
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.

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.
__________________
~Warm and Fuzzy.
virgohippy is offline   Reply With Quote
Old 2006-10-25, 07:48 AM   #3
Roni20
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
Roni20's Avatar
 
Join Date: Dec 2004
Posts: 79
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 ...
Roni20 is offline   Reply With Quote
Old 2006-10-26, 05:56 AM   #4
mOrrI
You can now put whatever you want in this space :)
 
mOrrI's Avatar
 
Join Date: Feb 2004
Location: Portugal
Posts: 1,083
For this u need to record the last selection...

and then check this last selection before choosing where to send the user...
__________________
mOrrI is offline   Reply With Quote
Old 2006-10-26, 01:02 PM   #5
kitty_kate
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
kitty_kate's Avatar
 
Join Date: Jun 2006
Location: The Colloseum
Posts: 155
Send a message via ICQ to kitty_kate
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.
__________________
My Asian Kitty - My Free Sites
kitty_kate is offline   Reply With Quote
Old 2006-10-26, 09:06 PM   #6
calmlikeabomb
Internet! Is that thing still around?
 
Join Date: Oct 2006
Location: unscrypted.com
Posts: 2
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
calmlikeabomb is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:15 PM.


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