Hi, looked around but i couldnt find much on this. I need to redirect every 3 visitors that visit my url to different sites. so visitor 1 would go to xyz.com, lets say visitor 2 comes along and he gets redirect to xzy.com then the last visitor comes along and gets redirected to yxz.com and then the process repeats itself. My idea so far is to create a file in php with a number stored in it then incrememnt the number and use the modulus operator to see if it is divisible by 1, 2, or three and use the header function depending on what the number is at. im sure there is an easier way, im fairly new to php, so any examples would be very very appreciated. thank you in advance. Dave
david cashin
0
Newbie Poster
Recommended Answers
Jump to PostDoes it really need to rotate like that or can you just send 33% of visitors to site one, 33% to site two, and 33% to site three.
Because then you can just use php's RAND() function to randomly pick a number between 1 and 3, and depending upon …
Jump to PostDoes it really need to rotate like that or can you just send 33% of visitors to site one, 33% to site two, and 33% to site three.
Because then you can just use php's RAND() function to randomly pick a number between 1 and 3, and depending upon which …
All 7 Replies
NettSite
19
Junior Poster in Training
diafol
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
diafol
commented:
Simple and non-intensive
+7
NettSite
19
Junior Poster in Training
diafol
david cashin
0
Newbie Poster
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.