<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Random quote generator</TITLE>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<META NAME="Author" CONTENT="Bo Johansson">
<META NAME="Keywords" CONTENT="php, random quote generator, quotes">
<META NAME="Description" CONTENT="PHP random quote generator">
<link REL="SHORTCUT ICON" href="../bj16html.ico">
<STYLE TYPE="text/css">
<!--
.tdimg TD IMG {display: block;}
//-->
</STYLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
var jsNavBase = "../"
//-->
</SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="../navbt/button_updwn.js">
<!--
//-->
</SCRIPT>
<?php
$navBase = "../";
$altLang = ""; // no Swedish version
$actPage = 99; // this page not in navbar
require("../navbt/nav_eng.php");
?>
</HEAD>
<BODY>
<?php
require("../navbt/nav_horz.php");
?>
<H1 ALIGN=CENTER>PHP-test 9</H1>
<H2 ALIGN=CENTER>Random quote generator</H2>
<HR>
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
*
* The quotes are in the text files "9_quote.txt" and
* "9ferengi.txt", and each of the individual quotes are
* separated by newline characters
*
* This version of the script by Bo Johansson 2002-05-10
*
* Modified by Bo Johansson 2003-08-29
*
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
if( $_SERVER['QUERY_STRING'] == "ferengi" )
{
$quotes = file('9ferengi.txt');
}
else
$quotes = file('9_quote.txt');
if (!$quotes)
{
print('<H3><FONT COLOR="#FF0000">The quote generator is');
print(' temporarily out of service</FONT><H3>');
}
else
{
srand ((double) microtime() * 1000000);
print( $quotes[rand(0,count($quotes))] );
}
if( !isset($_ENV['QUERY_STRING']) )
{
print("\n" . '<HR>' . "\n");
print('The qoute text file has been "borrowed" ');
print('from The Dendarii Nexus ' . "\n");
print('(<A HREF="http://www.dendarii.com">http://www.dendarii.com</A>),');
print("\n" . ' where it is also used to generate random quotes.');
}
?>
<HR>
<P>
<A HREF="9_quote.php"><B>New quote:</B></A> Click this
link to get a new quote from Lois McMaster Bujold.
<P><A HREF="9_quote.php?ferengi"><B>Ferengi:</B></A> Click this
link to get the "Ferengi Rules of Acquisition" instead.
<P><A HREF="9_quote.php?code"><B>View code:</B></A> Click this
link to see the code for this page.
<HR>
<?php
if( $_SERVER['QUERY_STRING'] == "code" )
{
print('<TABLE ALIGN=CENTER BGCOLOR="#FFFFCC" WIDTH="95%">');
print('<TR><TD>');
highlight_file("9_quote.php");
print('</TD></TR></TABLE>');
print('<HR>');
}
?>
<FONT SIZE="-2">Page created 2001-10-26, last changed
<?
print(date("Y-m-d H:i", getlastmod() ));
?>
</FONT>
<P>©
<?
print(date("Y", getlastmod() ));
?>
Bo Johansson
</BODY>
</HTML>
|