The Wayback Machine - https://web.archive.org/all/20060319102715/http://www.freescripts.com/random-text.php

Free Scripts
 
Banner Ads
Chat
Form Processor
GuestBook
MailFile
PostCard
 
Free Snippets
 
Cookies
Header/Footer
Random Text
Text Counter
 
Scripts Directory
 
ASP
ASP.NET
Java
Javascript
Perl
PHP
Python
XML
 
Misc.
 
Website Hosting
Resources 1 2 3 4 5
Web Hosting
Website Promotion
Mall
Hosting Directory
Add Listing
Contact Us
Webmaster Forums
Printing Companies
Web Hosting Guide
Free PHP scripts
Furniture
Logo & Website Design Contests
Graphic Design
Web Hosting Services
Dedicated Hosting
Ecommerce Hosting
Domain Registration Tools
JavaScript Search
Free Website Solutions
Web Hosting Reviews
Ecommerce & Web Developers Directory
DataCenter Dicussion
Online Link Exchange Directory
Your Hosting Infomation Directory
Free Software Downloads
Web Host Support Certification
Antivirus Software
Reseller Hosting
Graphic Design
Flash Website Templates
Freelance Work
Graphic Design Portal
Search Engine Optimization
Free Website Templates
Affordable Web Hosting
1000's of Website Templates
Exclusive Logo Designs
Pizzot.com
OMG Software
Websites and Domains
Freeware Network
Linkcentre.com Directory
iMovingGuide.com Moving Resources
Photoshop Tutorials
Web Hosting
JSP Web Hosting
Web Hosting
Development Tools and Components
Software News
Cgi2yoU.com
Web Hosting
Web Design
Resell Web Hosting
Dedicated Server Tutorials
Hot Software Novelties
 
Web Hosting Services
 
  Jumpline Hosting
With the ability to host 6 domains on one account, you can?t beat this low price. More Information.
 
Netfirms Web Hosting
Trusted by over 1,000,000 people and growing
 
Interland
Sell and Market Your Products Online
 
Dot5 Hosting
Award Winning Web Hosting JUST $5p/m
 
Partners
 
Link Partners
CCNA
 
 
 





Description

This script will pick from a list of quotes that you provide and display one randomly on the page.

Random Quote in PHP

Put this code in a file to get a random quote. The quotes file must be named quotes.txt and stored in the same directory as the random quote file.
<?
   $quoteFile = "quotes.txt";  //File holding qoutes

   $fp = fopen($quoteFile, "r");   //Opens file for read
   $content = fread($fp, filesize($quoteFile));
   $quotes = explode("\n",$content);   //Put quotes into array
   fclose($fp);   //Close the file

   srand((double)microtime()*1000000);  // randomize
   $index = (rand(1, sizeof($quotes)) - 1); //Pick random qoute

   echo $quotes[$index]; //Print quote to screen
?>

Random Quote in ASP

Just include the following code to print random text to the screen.
<%
Dim quotes(3), iNumber, iRandom     'Dim an array of 3 variables
quotes(0) = "First quote"
quotes(1) = "Second quote"
quotes(2) = "Third quote"

iRandom = ubound(quotes)
randomize                     'call random function
iNumber = Int((iRandom)* Rnd)      'get random quote number
Response.Write(arrQuote(iNumber))   'write output to screen
%>

Copyright © 1996 - 2003 JumpBug Enterprises
Read our Privacy Statement
Read our License Agreement