![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
So Fucking Banned
Join Date: Feb 2002
Location: Texas
Posts: 350
|
anyone with a simple php script?
I need a php script that will split my hits between 2 urls. for example.
1 hit in = redirects to url 1 another hit in = redirects to url 2 another hit in = redirects to url 1 so on and so forth...... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2002
Location: www.Reyko.com
Posts: 1,145
|
PHP Code:
I do not claim that this is the best solution ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
So Fucking Banned
Join Date: Feb 2002
Location: Texas
Posts: 350
|
thank you
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jan 1995
Posts: 2,417
|
PHP Code:
Here's a quick and dirty UNTESTED! way to do it... If you only want to redirect between 2 URLs and you want to keep them pretty even but not necessarily EXACTLY even, I would do something like that that didn't involve file I/O... any time you touch the disk it's going to get slow especially if you're going to throw a lot of traffic at it. This just checks to see if the current second is even or odd and then forwards to either url1 or url2... If you're only talking about 2 URLs and not needing to track any stats, I'd say something like this would work pretty damn well. ![]() So just copy that code into a php file, update the 2 urls and send traffic directly to the php page you create. Good Luck! -KC |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
So Fucking Banned
Join Date: Feb 2002
Location: Texas
Posts: 350
|
thx fellas, i went with KC's seems to be working great sofar
![]() i appreciate the input |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Dec 2001
Posts: 7,952
|
What's wrong with how i am doing it
<? $urls = array( 1 => "http://www.url1.com", 2 => "http://www.url2.com", 3 => "http://www.url3.com", 4 => "http://www.url4.com", ); srand ((double) microtime() * 1000000); $randnum = rand(1,4); $goto = $urls[$randnum]; header("Location: $goto"); ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Jan 1995
Posts: 2,417
|
4Pics,
Your's will work well also... ![]() For something simple like this, as long as it isn't hitting a database or reading & writing to a text file, just about ANYTHING will work... -KC |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Registered User
Industry Role:
Join Date: Mar 2002
Location: San Diego, CA
Posts: 935
|
I dunno what you're using this for, but you might consider stashing a cookie so that if/when the user/visitor ever comes back, he gets the alternate URL on the second visit.
Then you can do a "porn site" Survivor test where you can run 3-4-5 front ends, all receiving equal amounts of traffic and figure out which one is doing worst - pull it out, redesign it and put it back in the rotation and repeat. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Jan 2002
Location: Toronto
Posts: 1,227
|
Do it with java script - no server load + it will work for 99% of browsers.... if a simple java script wont work on the user, how can you expect a sponsor to track the signup??
![]()
__________________
Alex - ICQ:61889253 - MSN:zubr_zubr at hotmail.com - Skype:zubrzubr |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Industry Role:
Join Date: Jan 1995
Posts: 2,417
|
Quote:
I think relying on a browser to do a rotation job is unreliable. Especially when you have a fast server side technology like PHP available to you. (as this guy did) PHP doing something like this could easily hanle millions of hits per day, depending on the hardware. Speed and server load won't be a problem with something like this. -KC |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
So Fucking Banned
Join Date: Feb 2002
Location: Texas
Posts: 350
|
Yeah, i thought about javascript, but like you say most asswipes have it off or its not supported in some way, so php seemed like the only way togo, as far as cookies go, these visitors will only hit the site once (98% sure of that) so no need to stick a big fat nasty cookie in thier pc
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Confirmed User
Industry Role:
Join Date: Jan 1995
Posts: 2,417
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |