Hello to all !
I need help to modify an ad rotator !
What I need is to randomize the ads placement WITHOUT repeating the same ad twice.
Here is the php script (called in page) :
[php]
<?php // Function to display random ads from a list function showRandomAD($ADnumber = 1){ // Loading the ad list into an array $adList = file('adlist.txt'); // Check the total number of ads $numberOfADs = sizeof($adList); // Initialize the random generator list($usec, $sec) = explode(' ', microtime()); srand((float) $sec + ((float) $usec * 100000)); // Initialize the ads counter $adCount = 0; // Loop to display the requeste number of ads while ($adCount++ < $ADnumber) { // Generate random ad id $actAD = rand(0, $numberOfADs-1); // Display the above generated ad from the array echo $adList[$actAD].''; } } ?>
[/php]
Let me know if you can help… or if it can’t be done (if so, recommendations for an ad rotator that does what I want would be great, either Javascript or PHP) !
Thanks !
Ian