Random Ads - RMB Scripting
You appear not have have an account with us, Click HERE to register an account...
RMB Scripting
Navigation
  Home
  Contact
  FAQ
  Forum
  Topsites
  Members
  Competitions
  Affiliates
Downloads
  Templates
  Scripts
  Fonts
  Image Sets
  Software
  Other
 
Tutorials
  .htaccess
  Photoshop
  C/C++
  CSS
  Macromedia Flash
  MySQL
  PHP
  PHP - User System
  HTML
  Javascript
  Macromedia Fireworks
  Visual Basic
  Visual C#
  Windows
  Other
 
Latest Tutorials
Apache, PHP, MySQL on ...
Follow a Guide
Limit username restric...
Easy Captcha (finally!)
Poll System
Latest Comments
Limit username restric...
Whos Online
News CMS With Admin Panel
News CMS With Admin Panel
Apache, PHP, MySQL on ...
Stats
Total Members: 457 [149]
Total Tutorials: 235
Newsest User: Jakkkay
Todays Unique Hits: 221
Users Online: 4
MOD-Shadow, UrbanTwitch, jambomb, setsukemizuhara
5 Guests
Poll
Do you like this poll?
Yes
Maybe
No
Main Content
Tutorial: Random Ads By gbt91
First of all, create a file call random.php
   
PHP:

<?php

// load the file that contain the ads
$adfile "ads.txt";
$ads = array();

// one line per ad
$fh fopen($adfile"r");
while(!
feof($fh)) {

  
$line fgets($fh10240);
  
$line trim($line);
  if(
$line != "") {
    
$ads[] = $line;
  }
}

// randomly pick an ad
$num count($ads);
$idx rand(0$num-1);

echo 
$ads[$idx];
?>

everything is explained line per line
then create a txt file and call it ads.txt
   
CODE:

<a href="http://www." target="_blank"><img src="http://" width="468" height="60" border="0"></a>
<a href="http://www.">some ad</a>
<a href="http://www.">some more ad</a>

you can modify this as you want, i hope you just have a little knowledge of HTML...
then insert the following code in your page to display it
   
CODE:
<iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php">
</iframe>

you can also modify this as you want...
for other features dont border to pm me ^^
Difficulty: Easy
Views: 717
Rating:
Comments
Posted on Tuesday 15th May 2007 at 08:11 PM
DanielXP
What the JS function 'color_selected' for?
Posted on Wednesday 16th May 2007 at 12:04 PM
gbt91
oops...
since i took it from my page i forgot to take it off...
Posted on Wednesday 16th May 2007 at 04:12 PM
DanielXP
Updated.
Notice:
Remember to post long codes on our pastbin! - (http://rmb.pastebin.com/)
Add Comment
You must be logged in to post a comment.
Good Evening Guest
Username: 
Password: 
Remember Username
Links
RMB Arcade
GangstaMania
Free Domains
Free Games
Affiliates