|
“
// Quick random quote
// This script reads a quote file (flat text file), and picks one of the loaded
// quotes at random and displays it.
// Line breaks and formatting can be put into the quotefile as HTML tags
// Place the quotes.txt on your site, edit the $quotefile variable below,
// And copy and paste this code into your PHP page.
// $delim tells this script what delimits the quotes (default is a CR/LF)
$delim = "\n";
// $wuotefile points to the file that holds the actual quotes
$quotefile = "cus_quotes.txt";
$fp = fopen($quotefile, "r");
$contents = fread($fp, filesize($quotefile));
$quote_arr = explode($delim,$contents);
fclose($fp);
srand((double)microtime()*1000000);
$quote_index = (rand(1, sizeof($quote_arr)) - 1);
$herequote = $quote_arr[$quote_index];
echo $herequote;
?> “
|