"Hyur Midlander Male", 2 => "Hyur Midlander Female", 3 => "Hyur Highlander Male", 4 => "Elezen Wildwood Male", 5 => "Elezen Wildwood Female", 6 => "Elezen Duskwight Male", 7 => "Elezen Duskwight Female", 8 => "Lalafell Plainsfolk Male", 9 => "Lalafell Plainsfolk Female", 10 => "Lalafell Dunesfolk Male", 11 => "Lalafell Dunesfolk Female", 12 => "Miqo'te Seeker of the Sun Female", 13 => "Miqo'te Keeper of the Moon Female", 14 => "Roegadyn Sea Wolf Male", 15 => "Roegadyn Hellsguard Male" ); $g_guardians = array( 1 => "Halone, the Fury", 2 => "Menphina, the Lover", 3 => "Thaliak, the Scholar", 4 => "Nymeia, the Spinner", 5 => "Llymlaen, the Navigator", 6 => "Oschon, the Wanderer", 7 => "Byregot, the Builder", 8 => "Rhalgr, the Destroyer", 9 => "Azeyma, the Warden", 10 => "Nald'thal, the Traders", 11 => "Nophica, the Matron", 12 => "Althyk, the Keeper" ); $g_allegiances = array( 1 => "Limsa Lominsa", 2 => "Gridania", 3 => "Ul'dah", ); $g_htmlToDbFieldMapping = array( "characterName" => "name", "characterTribe" => "tribe", "characterSize" => "size", "characterVoice" => "voice", "characterSkinColor" => "skinColor", "characterHairStyle" => "hairStyle", "characterHairColor" => "hairColor", "characterHairOption" => "hairOption", "characterEyeColor" => "eyeColor", "characterFaceType" => "faceType", "characterFaceBrow" => "faceBrow", "characterFaceEye" => "faceEye", "characterFaceIris" => "faceIris", "characterFaceNose" => "faceNose", "characterFaceMouth" => "faceMouth", "characterFaceJaw" => "faceJaw", "characterFaceCheek" => "faceCheek", "characterFaceOption1" => "faceOption1", "characterFaceOption2" => "faceOption2", "characterGuardian" => "guardian", "characterBirthMonth" => "birthMonth", "characterBirthDay" => "birthDay", "characterAllegiance" => "allegiance", "characterWeapon1" => "weapon1", "characterWeapon2" => "weapon2", "characterHeadGear" => "headGear", "characterBodyGear" => "bodyGear", "characterLegsGear" => "legsGear", "characterHandsGear" => "handsGear", "characterFeetGear" => "feetGear", "characterWaistGear" => "waistGear", "characterRightEarGear" => "rightEarGear", "characterLeftEarGear" => "leftEarGear", "characterRightFingerGear" => "rightFingerGear", "characterLeftFingerGear" => "leftFingerGear" ); function SaveCharacter($databaseConnection, $htmlFieldMapping, $characterId) { $characterInfo = array(); foreach($htmlFieldMapping as $htmlFieldName => $dbFieldName) { $characterInfo[$dbFieldName] = $_POST[$htmlFieldName]; } UpdateCharacterInfo($databaseConnection, $characterId, $characterInfo); } function GenerateTextField($characterInfo, $htmlFieldMapping, $htmlFieldName, $fieldMaxLength = null) { $inputMaxLength = ($fieldMaxLength === null) ? "" : sprintf("maxlength=\"%d\"", $fieldMaxLength); return sprintf("", $htmlFieldName, $htmlFieldName, $characterInfo[$htmlFieldMapping[$htmlFieldName]], $inputMaxLength); } function GenerateSelectField($characterInfo, $htmlFieldMapping, $htmlFieldOptions, $htmlFieldName) { $dbFieldName = $htmlFieldMapping[$htmlFieldName]; $htmlText = sprintf("\n"; return $htmlText; } if(isset($_POST["cancel"])) { header("Location: control_panel.php"); exit; } if(isset($_POST["save"])) { SaveCharacter($g_databaseConnection, $g_htmlToDbFieldMapping, $g_characterId); header("Location: control_panel.php"); exit; } try { $g_characterInfo = GetCharacterInfo($g_databaseConnection, $g_userId, $g_characterId); } catch(Exception $e) { header("Location: control_panel.php"); exit; } ?>