Player Bio Control

"); switch($mode) { case "new": print("Please compete the following items to initialize the player's bio:

"); print("
Player Name:
Login ID:
Password:

"); break; case "update_db": if ($cat == 'N') { mysql_query("insert into player_bios(name,password,userid)VALUES('$name','$pword','$userid')"); $q = mysql_query("select idx from player_bios where userid = '$userid'"); if (mysql_numrows($q) <1) { print("There was an error please try again."); exit(); } else { $row = mysql_fetch_object($q); for ($i = 0; $i < count($players); $i++) { mysql_query("update crew set p_bio = '$row->idx' where ID = '$players[$i]' and ship = '$ship_num'"); } print("Player Bio Setup Complete. You should now send the player their new userid and password so that they can complete their bio section.

Player name: $name
Player Login ID: $userid
Player password: $pword
"); } } else { mysql_query("update player_bios set name = '$name', userid='$userid', password='$pword' where idx = '$idx'"); mysql_query("update crew set p_bio = 0 where p_bio='$idx'"); for ($i = 0; $i < count($players); $i++) { mysql_query("update crew set p_bio = '$idx' where ID = '$players[$i]' and ship = '$ship_num'"); } } break; case "add_new": $error=0; if (empty($name)) { print("You must enter a player name.
"); $error=1; } if (empty($userid)) { print("You must enter a logini ID.
"); $error=1; } if (empty($pword)) { print("You must enter a password.
"); $error=1; } $q = mysql_query("select * from player_bios where userid = '$userid' and ship = '$ship_num'"); if (mysql_numrows($q) >0) { print("This userid is already in use. Please select another
"); $error=1;} if ($error ==1) { print("
Player Name:
Login ID:
Password:

"); } else { print("

Please select the character(s) that this player will play:
"); $q = mysql_query("select * from crew where p_bio = 0 and ship='$ship_num' and status in ('RNPC','PC')"); if (mysql_numrows($q) <1) { print("There are no unassigned characters in the database. "); } else { print("

"); while($row = mysql_fetch_object($q)) { print(" $row->Name
"); } print("
"); } } break; case "update": $q = "select * from player_bios where idx = $idx"; $data = mysql_query($q); $row = mysql_fetch_object($data); print("
Player Name:
Player Loginm ID:
Player Password:

Character Assignments:
The character with check marks are already assigned to him/her. Those without have no assignment yet.

"); $q2 = "SELECT * FROM crew where ship = $ship_num and p_bio in('$row->idx','0') and status in ('RNPC','PC')"; $chdata = mysql_query($q2); while($row2=mysql_fetch_object($chdata)) { $ch_name = $row2->Name; if ($row->idx == $row2->p_bio) {$status = "CHECKED";} else {$status = "OFF"; } print(" $ch_name
"); } print("
"); break; default: print("

The following Players have bios set up:

"); $q = "select * from player_bios where ship = '$ship_num'"; $bios = mysql_query($q); if (mysql_numrows($bios) <=1) { print("You currently do not have any bios set up
"); } else { while($row=mysql_fetch_object($bios)) { print("idx>$row->name
"); } } print("

Add a new player bio"); }