ciao ho un piccolo problema con un file php che mi randomizza una serie di banner situati in una certa cartella.
ebbene i banner vengono sostituiti ad ogni refresh, e visto che la cosa potrebbe risultare fastidiosa vorrei alzare questo limite a 5/7 refresh.
di php non so moltissimo, ma con la programmazione in generale me la cavo ;)Codice:<?php /* Based on code by Perpetual Dreamer and Alland. */ //directory here (relative to script) $path = '..directory delle immagini'; $i = 0; $imgDir = opendir ($path); while ( $file = readdir( $imgDir ) ) { //checks that file is an image $file_type = strrchr( $file, "." ); $is_image = eregi( "jpg|gif",$file_type ); if ( $file != '.' && $file != '..' && $is_image ) { $images[$i++] = $file; } } closedir ($imgDir); srand( (double) microtime()*1000000 ); $image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )]; $imgSize = GetImageSize( $image_name ); //ends script if no images found if ( $i == 0 ) die(); //Display the image readfile("$image_name"); ?>
ho provato a cercare info su microtime ma niente
grazie a chi voglia darmi una mano!

LinkBack URL
About LinkBacks


