PHP Name Generator
PHP
Download (.zip)
<html> <head> <title>Generate Your Wu-Name</title> </head> <body bgcolor="#FFFFFF">
<h2>Generate Your Wu-Name</h2> <p><hr size=1 noshade></p>
<form action="<?=$SCRIPT_NAME?>" method="POST"> <p><b>Enter your Name: </b><br> <input type="text" name="realname" size=25> <input type="submit" value="Submit"> </p> </form>
<p><hr size=1 noshade></p>
<? if ($REQUEST_METHOD == "POST") { $displayname = $realname; $realname = strtolower($realname);
/*== generate seed number from name submitted ==*/ $len = strlen($realname); $seed = 0; $s = 0;
for ($e=1; $e<=$len; $e++) { $chr = substr($realname,$s,$e); $seed = $seed + ord($chr)*$e;
$s=$e; }
/*== read in the two files into the arrays ==*/ $adj_array = file("wu_adjs"); $noun_array = file("wu_nouns");
/*== set random seed ==*/ srand($seed);
/*== get the random numbers for each name first/last or adj/noun ==*/ $arnd = rand(0,sizeof($adj_array)-1); $nrnd = rand(0,sizeof($noun_array)-1);
/*== create name from random numbers ==*/ $wuname = "$adj_array[$arnd] $noun_array[$nrnd]";
print "<p><font size=4><b>$displayname</b> from this day forward you <br>you will also be known as "; print "<font size='+1'><b> $wuname </b></font></font></p>";
} ?>
|