/* Config Part --------------------------------------------------------------------------------------------------------------*/
display_errors = On
error_reporting = E_ALL
$random = true; // if you want random, keep true, set to false if want sequential
$directory = "randomQuote/"; // Webserver path to your quote files with / on end!
$quotefile = "randomquote.inc"; // The Random Quote file
$quotecountfile = "displayquote.inc"; // The Display Quote file (IF SEQUENTIAL!)
/* End of Config Part -------------------------------------------------------------------------------------------------------*/
$quotes = file($directory.$quotefile);
$number = count($quotes);
if($random){
$num = rand(0,$number-1);
}
else{
$num = file($directory.$quotecountfile);
$num = $num[0]+1;
if( $num == $number ){ // If ran out of quotes, start again!
$num=0;
}
if (file_exists($directory.$quotecountfile)) {
$nu = fopen ($directory.$quotecountfile, "w");
fputs($nu,$num);
}
else {
die("Cant Find $quotecountfile");
}
}
// display the quote on the page
echo "$quotes[$num]";
?>
|