IEN Officers - generation

<php> work out how many officers to promote. $Ensigns = rand(1,20) * rand (1,6); $Lts = $Ensigns + rand(1,10) * rand (1,6); $LtCdrs = $Lts + rand (0,10) * rand(1,5); $Cdrs = $LtCdrs + rand (0,8) * rand(1,5); $Capts = $Cdrs + rand (0,4) * rand (0,1); $RAdms = $Capts + rand (0,1) * rand (0,1) * rand(0,4); $Apps = rand (6,200); $no = 590000; set up some arrays as lookups for the values from the d10 rolls $Branch = array (“Pilot”, “Astronaut”, “Pacifier Pilot”, “Command”, “Astronaut”, “Technical”, “Legal”, “Medical”, “Logistics”, “Marine”); $Posting = array (“Small Ship”, “Capital Ship”, “Logs Ship”, “Shipyard”, “Training”, “Port Staff”, “Special Duties”, “Staff”, “Staff”, “Naval Academy”, “Command”, “Command”, “Admiralty”, “Command”); $Ranks = array (“Ensign”, “Lieutenant”, “Lt.Commander”, “Commander”, “Captain”, “Rear Admiral”, “Vice Admiral”, “Admiral of the White”, “Admiral of the Black”, “Grand Admiral”);

set up a table inside a form so that the chosen applicants can be taken forwards to the next stage. echo “The following Officers have been promoted with effect from 3209.001 \n”; echo “\n”; Echo “ ^ No. ^ Rank ^ Firstname ^ Surname ^ Branch ^ Posting ^ Location ^ \n”; $appl=1; for each applicant then roll the various dice and then set the variables do

{
  $Experience=rand(0,9);
  $post=rand(0,9);
  $Gender=rand(0,8);
  $BirthGender=$Gender;
  $GenderChanged="No";
  if($Gender==0)
    {
     $GenderChanged="Yes";
     $BirthGender=rand(1,8);
     $Gender=rand(1,8);
    }
  if($Gender==9)
    {
     $BirthGender=rand(1,8);
     $gend="Cyborg";
    }
      if($Gender<5)
    { $sex="M"; $gend="M"; }
  elseif($Gender<9)
    { $sex="F"; $gend="F"; }
  elseif($BirthGender<5)
    { $sex="M"; $gend="M"; }
  else
    { $sex="F"; $gend="F"; }
  $Homeworld="Earth, Q0";
  $gen=rand(0,9);
    if($gen > 3)
      {
        // set the necessary connection variables to connect to MySQL
        include ("/var/www/html/INI/sqlconnect.php"); 
        // connect to MySQL server and select the INI database
        include ("/var/www/html/INI/sqlconnect2.php"); 
        $db1 = mysql_select_db('full-moon_info_-_INI',$connection);
        // randomly select a system from the database 
        $sql1 = 'SELECT * FROM `stardata` where control = "EE" ORDER BY Rand() LIMIT 5';
        $homes = mysql_query($sql1);
        while ($row1=mysql_fetch_array($homes,MYSQL_ASSOC))
         {
          end($row1);
          extract($row1);
          
          $Homeworld = "$StarName, Q$Quadrant";
         } 
       }

work out the officer's rank (before promotion) if($appl<$Ensigns) {$rank=0;} elseif($appl>$RAdms) {rank=5;} elseif($appl>$Capts) {rank=4;} elseif($appl>$Cdrs) {rank=3;} elseif($appl>$LtCdrs) {rank=2;} else {rank=1;} Modify posting score

 $posting = $post + $rank;
 $newrank = $rank +1;
         

set the necessary connection variables to connect to MySQL include (“/var/www/html/IFU/sqlconnect.php”); 21 connect to MySQL server and select the IFU database 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);

then randomly take a firstname of the correct gender from the same list if ($Gender==$sex) { $Forename = $FirstName; next($row); extract($row); end($row); } } $Surnames = mysql_query($sql2); $Surname = $Surnames[“Surname”]; $sql2 = 'SELECT * FROM `Names` WHERE Gender=$sex ORDER BY Rand() LIMIT 2'; $FirstName = $names[“FirstName”]; $no=$no-rand(1,100); echo “<br> | $no | $Ranks[$rank] | $Forename | $Surname | $Branch[$Experience] | $Posting[$posting] | $Homeworld | \n ”; $appl++; } while ($appl⇐$apps); </php> officers2 Randomly Generated Officers