Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Banner

Semplice script per la rotazione di banner pubblicitari.



<?php

/* banner.phtml
Requisiti:
Copiare i banner in una directory
I nomi dei file iniziano con "banner"
non ci sono altri file nella directory che iniziano con "banner"
Installazione:
Mettere lo script nella directory dei banner
Mettere tutti i banner nella stessa directory
Aggiungere il seguente codice alle pagine
<a href="www.sitolinkato.com">
<img src="http://www.iltuosito.com/directorybanner/banner.phtml" alt="Banner Random" border=0>
</a>
*/

/*
nota:
random( $max integer )
restituisce un numero casuale tra 0 e $max-1;
*/

function random( $max ) {
    $x = rand();
    $y = getrandmax();
    $r = $x / $y * ($max -1 );
    $r = round( $r++ );
    return $r;
}

/* Legger la directory per trovare i banner */

$i = 0;
$d = dir(".");
while($entry=$d->read())
    if (substr($entry,0,6) == "banner")
        $array[$i++] = $entry;
        $d->close();

/* Prende un banner */

$r = random( $i );

/* Invia il file */

Header( "Pragma: no-cache" );
Header( "Expires: Monday 01-Jan-80 12:00:00 GMT" );
Header( "Content-type: image/gif");
passthru( "cat $array[$r]" );
?>


Scarica il Codice...


Stampa la pagina


 








Inizio pagina

risorse per webmaster

php

php

php, mail, database, banner
php, banner,

Vai nel sito Morpheusweb.it - Risorse per Webmaster troverai quello che stai cercando
php, banner,
Nel nostro sito molte informazioni: "Morpheusweb.it - Risorse per Webmaster" tratta di php, script, forms, mail, database
click here se non sei reindirizzato automaticamente al nostro sito.

php, script, banner, mail, database, , ,