Are you looking for a script that can randomly rotate webpages or images?
Right, if you are looking for a script that can do what I have mentioned above then you've come to the right place. In this post I'm going to show you a small yet powerful php script which can either rotate only links and images or it can rotate all of the mixed together.
What do you need to do?
You need to create two file, first one PHP (php code goes in this file) and the other one just a plain TXT file (here all the urls and image liks goes) make sure that both (php and txt) files are in the same directory.
Where to put URLs and image links?
As I have told you before that you need to put all the image links and page urls in the "text" file but make that every singe link should be in separate line as you can see in the picture below.
.....................................................................................................................................................................
.....................................................................................................................................................................
The code.
<?php
$urlist=file("links.txt");
$nl=count($urlist);
$np=rand(0,$nl-1);
$url=trim($urlist[$np]);
header("Location: $url");
exit;
?>
Note: if you rename the txt file then you'll have to edit "links.txt" in the php code as well.
That's it enjoye!!!
I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
ReplyDeleteRegards,
Web design course in Chennai|Web design training in chennai