Help with a PHP URL rotator

Techxan

Elite Member
Joined
Dec 7, 2011
Messages
3,091
Reaction score
3,440
Please PM me with how much you would charge to fix this for me.

I have a URL rotator that acts this way:

The first time you visit it you see URL 1 from a link list. The second time you see URL 2, and so on. Every visitor sees this same pattern, so you have to visit the site 5 times in order to see all 5 sites.

What I want it to do is show the first URL to the first viewer, URL 2 to the second, and so on then restart the cycle. This way, if I run a test of 10,000 views to 5 websites they will each get 2000 views.

It would be nice if the script could present the same page upon revisit, but this is not critical.

I intend to share this on BHW (both versions).

Link to script (zipped)
http://www.mediafire.com/?rcvy3f4rdwwy06w

Virus total
https://www.virustotal.com/file/04f...8f7521af2e4d2867f09bc520/analysis/1335098438/
File name:rotatelinks.zip
Detection ratio:
Analysis date: 2012-04-22 12:40:38 UTC ( 0 minutes ago )

[TD="class: text-green"]0 / 42[/TD]



Thank you for your time and consideration.
 
Last edited:
Please PM me with how much you would charge to fix this for me.

I have a URL rotator that acts this way:

The first time you visit it you see URL 1 from a link list. The second time you see URL 2, and so on. Every visitor sees this same pattern, so you have to visit the site 5 times in order to see all 5 sites.

What I want it to do is show the first URL to the first viewer, URL 2 to the second, and so on then restart the cycle. This way, if I run a test of 10,000 views to 5 websites they will each get 2000 views.

It would be nice if the script could present the same page upon revisit, but this is not critical.

I intend to share this on BHW (both versions).

Link to script (zipped)
http://www.mediafire.com/?rcvy3f4rdwwy06w

Virus total
https://www.virustotal.com/file/04f9d30b00a8993c224f9210de715a35b8f8c28c8f7521af2e4d2867f09bc520/analysis/1335098438/
File name:rotatelinks.zip
Detection ratio:
Analysis date: 2012-04-22 12:40:38 UTC ( 0 minutes ago )

[TD="class: text-green"]0 / 42[/TD]



Thank you for your time and consideration.

You can do that with simple statistics.

$page = rand(1,5);
$linkurl = ($linksarray[$page]);header("Location: $linkurl");

In 10000 visits you sites should get ~2000 each.
 
Simple to you, encrypted Greek translation of ancient Sumerian hieroglyphics to me.

So do I add that somewhere in my script, or is that the whole script?

I still struggle with CSS....

and thank you very much.
 
The full script would be:

Code:
<?php
$file_handle = fopen("links.txt", "r");
while (!feof($file_handle)) {
    $linksarray[] = fgets($file_handle);
}
fclose($file_handle);
$rand = rand(1,5);
$linkurl = ($linksarray[$rand]);
header("Location: $linkurl");
?>
 
Thanks,

I appreciate it very much.
 
Last edited:
The first time you visit it you see URL 1 from a link list. The second time you see URL 2, and so on. Every visitor sees this same pattern, so you have to visit the site 5 times in order to see all 5 sites.

What I want it to do is show the first URL to the first viewer, URL 2 to the second, and so on then restart the cycle. This way, if I run a test of 10,000 views to 5 websites they will each get 2000 views.

It would be nice if the script could present the same page upon revisit, but this is not critical.

These 3 doesnt go together as I read it.

So I come to your site, I see the 1st url. Then next time I visit, I should see the second one? Or the second one is for the second visitor? Or how exactly do you want it to be?

So, next time I visit, that counts as a refresh or as a second visit? so it should show the same url or the next one?
 
can make it in javascript ( you will only need an html page (that u can host on amazon s3 ) ) ( you can put it in a share pluging button so the visitor will share a different facebook link each time))

pm me
 
The full script would be:

Code:
<?php
$file_handle = fopen("links.txt", "r");
while (!feof($file_handle)) {
    $linksarray[] = fgets($file_handle);
}
fclose($file_handle);
$rand = rand(1,5);
$linkurl = ($linksarray[$rand]);
header("Location: $linkurl");
?>

I believe that should be rand(0,4) The first element of an array is 0 so you'll never get to the first element using rand(1,5).
 
Back
Top