Forgot Password / Register
Site Statistics
Total Members: 510
Total Tutorials: 242
Newsest User: Hp
Todays Unique Hits: 121
0 Users 2 Guests Online

Random Ads

First of all, create a file call random.php
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?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 ^^
gbt91
Author:
Views:
1888
Rating:
Posted on Wednesday 16th May 2007 at 04:12 PM
DanielXP
DanielXP
Updated.
Posted on Wednesday 16th May 2007 at 12:04 PM
gbt91
gbt91
oops...
since i took it from my page i forgot to take it off...
Posted on Tuesday 15th May 2007 at 08:11 PM
DanielXP
DanielXP
What the JS function 'color_selected' for?