Banner Program .? Php * banner. php this PHP3 rolling program is designed by mongoolsen (aolsen@graphweb.com), you can freely modify and use this program, and freely spread it if you are on it /* Banner. php
This PHP3 rolling program is designed by Anton Olsen (aolsen@graphweb.com), you can freely modify and use this program, and freely spread it, if you have made important changes to it, please write an e-mail for all your work.
In this program, the author tries to implement this function in a variety of different ways, but the image function in PHP cannot display the GIF image format of the animation and the operations in this format (such as: fopen, fpassthru, and fclose ). The author has implemented it through the passthru method. Although this is not the best method, it can display ad strips more quickly than other methods.
In this program, we assume that:
1. you already have a directory for storing all advertisement images.
2. All advertisement images are in GIF format.
3. all GIF images start with a banner.
3. there are no other files except advertisement images in this directory.
Install this program:
1. put this program and all advertisement images (*. GIF) in a directory.
2. Place the following HTML code on your WEB page:
4/14/2000 Mouse Chen (litmouse@km169.net) Translate it to Chinese
*/
/* Random ($ max integer)
Returns a random number from 0 to $ MAX-1;
*/
Function random ($ max)
{
$ X = rand ();
$ Y = getrandmax ();
$ R = $ x/$ y * ($ max-1 );
$ R = round ($ r ++ );
Return $ r;
}
/* Read the directory and read all the "banner *" files into an array ;*/
$ I = 0;
$ D = dir (".");
While ($ entry = $ d-> read ())
If (substr ($ entry, 0, 6) = "banner ")
$ Array [$ I ++] = $ entry;
$ D-> close ();
/* Select a random number */
$ R = random ($ I );
/* Send a no-cache and gif file header and output the image. */
Header ("Pragma: no-cache ");
Header ("Expires: Monday 01-Jan-80 12:00:00 GMT ");
Header ("Content-type: image/gif ");
Passthru ("cat $ array [$ r]");
?>
Http://www.bkjia.com/PHPjc/316881.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/316881.htmlTechArticle? Php/* banner. php this PHP3 rolling program is designed by Anton Olsen (aolsen@graphweb.com), you can freely modify and use this program, and freely spread it if you're on it...