Php > Miscellaneous
Random Quote
Random Quote quote.php: $lim = "\n"; $quote = "quotes.txt"; //File holding qoutes $fp = fopen($quote, "r"); $content = fread($fp, filesize($quote)); $quotearr = explode($lim,$content); fclose($fp); srand((double)microtime()*1000000); //Start the randomness $index = (rand(1, sizeof($quotearr)) - 1); //Pick random qoute $rquote = $quotearr[$index]; //Return the qoute echo $rquote; ?> Now, createa file called quotes.txt and in their add youre quotes, make sure each one is seperated by a new line. Then simply use include 'quote.php'; to show the quotes on a page :)
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage