Random Include

Printer-friendly versionPDF version
No votes yet

This scripts includes files randomly in your php script. It can be used as a good ad rotator also.

Installation:

  1. First rename all the files you want to include randomly in a series. I mean like this
    "file_1.txt, file_2.txt, file3.txt ....

  2. Upload them into your server

  3. Open the random_include.php file with notepad and edit it like below.

Here is the code of the script

<?
// Set the lowest & highest numeric point in you series names of your includes files
$sl = rand(1,4);
//This line sets url of your include files
include ('includes/file_'.$sl.'.txt');
?>

That's all. Upload the script to your server and hope it will work fine. :D

Source Files: