包含以下文件:
random_quote.fla
random_quote.swf
random_quote.html
get_random.phtml
db_schema.txt
1)db_schema.txt
CREATE TABLE flash_random (
id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
quote text NOT NULL,
UNIQUE id (id)
);
INSERT INTO flash_random VALUES( '1', "We are all in the gutter, but some of us are looking at the stars. -- Oscar Wilde");
INSERT INTO flash_random VALUES( '2', "The shortest distance between two points is under construction. -- Noelie Alito");
INSERT INTO flash_random VALUES( '3', "Beware of self-styled experts: an ex is a has-been, and a spurt is a drip under pressure.");
INSERT INTO flash_random VALUES( '4', "The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system.");
INSERT INTO flash_random VALUES( '5', "Any fool can paint a picture, but it takes a wise person to be able to sell it.");
INSERT INTO flash_random VALUES( '6', "Your lucky number has been disconnected.");
INSERT INTO flash_random VALUES( '7', "A gleekzorp without a tornpee is like a quop without a fertsneet (sort of).");
INSERT INTO flash_random VALUES( '8', "With all the fancy scientists in the world, why can't they just once build a nuclear balm?");
INSERT INTO flash_random VALUES( '9', "Never make anything simple and efficient when a way can be found to make it complex and wonderful.");
INSERT INTO flash_random VALUES( '10', "I stopped believing in Santa Claus when I was six. Mother took me to see him in a department store and he asked for my autograph. -- Shirley Temple");
INSERT INTO flash_random VALUES( '11', "FLASH! Intelligence of mankind decreasing. Details at ... uh, when the little hand is on the ....");
INSERT INTO flash_random VALUES( '12', "Antonym, n.: The opposite of the word you're trying to think of.");
INSERT INTO flash_random VALUES( '13', "A sense of humor keen enough to show a man his own absurdities will keep him from the commission of all sins, or nearly all, save those that are worth committing. -- Samuel Butler");
INSERT INTO flash_random VALUES( '14', "Spirtle, n.: The fine stream from a grapefruit that always lands right in your eye. -- Sniglets, Rich Hall & Friends");
INSERT INTO flash_random VALUES( '15', "Frankfort, Kentucky, makes it against the law to shoot off a policeman's tie.");
INSERT INTO flash_random VALUES( '16', "Economists state their GNP growth projections to the nearest tenth of a percentage point to prove they have a sense of humor. -- Edgar R. Fiedler");
INSERT INTO flash_random VALUES( '17', "Walk softly and carry a megawatt laser.");
INSERT INTO flash_random VALUES( '18', "Anyone can make an omelet with eggs. The trick is to make one with none.");
INSERT INTO flash_random VALUES( '19', "As long as war is regarded as wicked, it will always have its fascination. When it is looked upon as vulgar, it will cease to be popular. -- Oscar Wilde");
INSERT INTO flash_random VALUES( '20', "If only I could be respected without having to be respectable.");
INSERT INTO flash_random VALUES( '21', "Life is a yo-yo, and mankind ties knots in the string.");
2) php的代码
<? // connect to db
$db = mysql_connect("servername", "username", "password") or die ("Couldn't connect.");
mysql_select_db("yourDB", $db) or die ("Couldn't select db.");
// get count of quotes, as high limit for rand()
$get_count = "select count(id) from flash_random";
$count_result = mysql_query($get_count) or die ("Couldn't get count.");
$count = mysql_result($count_result, 0, "count(id)");
// seed random number generator
srand((double)microtime()*1000000);
// generate random id with high limit if $count
$random_id = rand(1, $count);
// get quote based on $random_id
$get_quote = "select quote from flash_random where id = '$random_id'";
$quote_result = mysql_query($get_quote) or die ("Couldn't get quote.");
$quote = mysql_result($quote_result, 0, "quote");
$send_quote = "quote=";
$send_quote .= rawurlencode($quote);
echo "$send_quote";
?>
3)html代码
<HTML>
<HEAD>
<TITLE>random_quote</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
ID=random_quote WIDTH=400 HEIGHT=400>
<PARAM NAME=movie VALUE="random_quote.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="random_quote.swf" quality=high bgcolor=#FFFFFF WIDTH=400 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
</BODY>
</HTML>
其它的自己在flash生成一个,测试请看下面站点
http://www.thickbook.com/extra/php_flashyquote.phtml
|