Applicants
<php> $ad=2; $loc=8; $time=20;
echo “AD = $ad \n Location = $loc \n Time = $time \n\n<br><br>”; if ($ad == 1)
{ $cost = 1.5 * $time; if ($time == 30) { $ads = 2; } $ads = 1; }
if ($ad == 2)
{ $cost = 5 * $time; if ($time == 10) { $ads = 2; } $ads = 3; }
if ($ad == 4)
{ $cost = 25 * $time; $ads = $ad + ($time/10-1); }
$d6 = rand (1,6); $apps = $d6 * $ads * $loc; echo “<b>Number of Applicants ($apps)</b> = Recruiting score for Advertising ($ads) x Location Score ($loc) x 1d6 ($d6).”; echo “<br>\n
Recruitment cost $cost credits<br>";
echo ”<h2>Applicant Details</h2> \n
\n
<table width = 85% cellpadding = 1>\n
<tr> \n
<td>App \n
<td>Firstname \n
<td>Surname \n
<td>Gender \n
<td>Genetics \n
<td>References \n
<td>CR Check \n
<td>Experience \n
<td>Interview? \n
<td>Hire? \n
</tr>";
$appl=1; do
{ $CrimCheck=rand(0,9); $Experience=rand(0,9); $RefCheck=rand(0,9); $Gender=rand(0,9); $BirthGender=$Gender; $GenderChanged="No"; if($Gender==0) { $GenderChanged="Yes"; $BirthGender=rand(1,8); $Gender=rand(1,8); } if($Gender==9) { $BirthGender=rand(1,8); } if($Gender<5) { $sex="M"; } elseif($Gender<9) { $sex="F"; } elseif($BirthGender<5) { $sex="M"; } else { $sex="F"; } $Genetics="Natural"; $gen=rand(1,6); if($Experience>8) { $Genetics="Perfect"; } elseif($gen>4) { $Genetics="Perfect"; }
connect to MySQL server and select the IFU database include (“/var/www/html/IFU/sqlconnect.php”); include (“/var/www/html/IFU/sqlconnect2.php”); $db = mysql_select_db('full-moon_info_-_IFU',$connection); randomly select a group of names from the database $sql = 'SELECT * FROM `Names` ORDER BY Rand() LIMIT 10'; $names = mysql_query($sql);
step through the selected list of names to get a surname and forename from separate rows while ($row=mysql_fetch_array($names,MYSQL_ASSOC)) { extract($row); $LastName = $Surname; next($row); then randomly take a firstname of the correct gender from the same list
if ($Gender==$sex)
{
$Forename = $FirstName;
next($row);
extract($row);
end($row);
}
}
echo “
<tr> \n
<td>$appl \n
<td>$seed2 $FirstName \n
<td>$seed1 $Surname \n
<td>$sex \n
<td>$Genetics \n
<td>$RefCheck \n
<td>$CrimCheck \n
<td>$Experience \n
<td>Interview? \n
<td>Hire? \n
</tr>";
$appl++; } while ($appl⇐$apps); echo ”</table>“; </php>