require "constants.php"; $title = "Anathema Online - Profile Management"; include "index-top.php"; if ($logged_in) { if ($_POST['mode'] == "edit") { $conditions = "WHERE id='$userId'"; $newpass = $_POST['newpass']; $oldpass = md5($_POST['oldpass']); $age = $_POST['age']; $species = addslashes($_POST['species']); $description = nl2br($_POST['description']); $leave = $_POST['leave']; $rank = $_POST['rank']; $rankposition = $_POST['rankposition']; $droprank = $_POST['droprank']; if (($droprank) && (getInfo(id,custom_ranks,"WHERE id='$userId'"))) { $query = "DELETE FROM custom_ranks WHERE user='$userId'"; mysql_query($query); } if ($rank) { $money = getInfo(money,users,"WHERE id='$userId'"); if ($money < 1000) $failure = "You do not have enough money."; if (!getInfo(nationality,users,"WHERE id='$userId'")) $failure = "You are not linked to any kingdom, and therefore cannot be given a rank."; if (getInfo(id,custom_ranks,"WHERE user='$userId'")) $failure = "You already have a custom title that is either active or under review."; if (!$rankposition) $failure = "You must select whether you want the title to appear before your name or after it."; } if (!getInfo(bonus,users,"WHERE id='$userId'")) $bonus = $_POST['bonus']; if ($bonus) { $characters = getInfo(characters,accounts,"WHERE username='$account'"); $characters = explode('.',$characters); $max = count($characters); for ($i = 0;$i < $max;$i++) { $character = $characters[$i]; $bonus_skills[] = getInfo(bonus,users,"WHERE id='$character'"); } if (inArray($bonus,$bonus_skills)) $failure = "You may not select a bonus skill that one of your other characters already has."; } if (!getInfo(civic,users,"WHERE id='$userId'")) $civic = $_POST['civic']; if (!getInfo(personal,users,"WHERE id='$userId'")) $personal = $_POST['personal']; if (($leave) && (getInfo(nationality,users,"WHERE id='$userId'") == getInfo(id,kingdoms,"WHERE leader='$userId'"))) $failure = "You are either trying to leave your own kingdom, or simply do not belong to a kingdom to begin with."; if (html_format($description)) $failure = "Please remove the HTML from the description."; if (html($species)) $failure = "Please remove the HTML from the species."; if ((preg_match("/[^0-9]/i",$age)) && ($age)) $failure = "The age must consist of numbers only."; if (!$failure) { if ($newpass) { $password = getInfo(password,users,$conditions); if ($oldpass == $password) { $newpass = md5($newpass); $query = "UPDATE users SET password='$newpass' WHERE id='$userId'"; mysql_query($query); } else $failure .= "The old password you entered did not match the one in the database."; } if ($rank) { $money -= 1000; $query = "UPDATE users SET money='$money' WHERE id='$userId'"; mysql_query($query); $nationality = getInfo(nationality,users,"WHERE id='$userId'"); $query = "INSERT INTO custom_ranks VALUES('','$userId','$rank','$rankposition','$nationality','hold')"; mysql_query($query); $leader = getInfo(leader,kingdoms,"WHERE id='$nationality'"); $leader = getInfo(username,users,"WHERE id='$leader'"); sendMessage($leader,"Custom Title Application","$user_name is applying for a custom title. Please check your kingdom's control panel to review the application.","God"); } if ($bonus) { $query = "UPDATE users SET bonus='$bonus' WHERE id='$userId'"; mysql_query($query); } if ($civic) { $query = "UPDATE users SET civic='$civic' WHERE id='$userId'"; mysql_query($query); } if ($personal) { $query = "UPDATE users SET personal='$personal' WHERE id='$userId'"; mysql_query($query); } $query = "UPDATE users SET age='$age' WHERE id='$userId'"; mysql_query($query); $query = "UPDATE users SET species='$species' WHERE id='$userId'"; mysql_query($query); $query = "UPDATE users SET description='$description' WHERE id='$userId'"; mysql_query($query); if ($leave) { $query = "UPDATE users SET nationality='' WHERE id='$userId'"; mysql_query($query); $query = "UPDATE users SET home='' WHERE id='$userId'"; mysql_query($query); $query = "DELETE FROM custom_ranks WHERE user='$userId'"; mysql_query($query); $money = getInfo(money,banks,"WHERE username='$userId'"); $inventory = getInfo(inventory,users,"WHERE id='$userId'"); $money += getInfo(money,users,"WHERE id='$userId'"); if (getInfo(inventory,banks,"WHERE username='$userId'")) $inventory .= getInfo(inventory,banks,"WHERE username='$userId'"); $query = "UPDATE users SET money='$money' WHERE id='$userId'"; mysql_query($query); $query = "UPDATE users SET inventory='$inventory' WHERE id='$userId'"; mysql_query($query); $query = "DELETE FROM banks WHERE username='$userId'"; mysql_query($query); $max = numRows(lords); for ($i = 1;$i <= $max;$i++) { $lord = getInfo(name,lords,"WHERE id='$i'"); $knights = getInfo(knights,lords,"WHERE id='$i'"); $knights = explode('.',$knights); if ($lord == $userId) { $query = "DELETE FROM lords WHERE id='$i'"; mysql_query($query); } if (inArray($userId,$knights)) { unset($knights[position($userId,$knights)]); $knights = implode('.',$knights); $query = "UPDATE lords SET knights='$knights' WHERE id='$i'"; mysql_query($query); } } $query = "UPDATE towns SET kingdom='' WHERE leader='$userId'"; mysql_query($query); } } echo '
| ';
echo ' | ';
echo '
|---|
| ';
if ($failure) echo ' | ';
echo '
| ';
echo ' | ';
echo '
|---|
| ';
echo ' | ';
echo '
| ';
echo ' | ';
echo '
|---|
| ';
echo ' | ';
echo '
| ';
echo ' | ';
echo '
|---|
| ';
echo ' '; $bonus = getInfo(bonus,users,"WHERE id='$userId'"); if ((getInfo("class",users,"WHERE id='$userId'") == "*") && ($bonus)) { echo ''; } echo ''; echo ' | ';
echo '
| ';
echo ' | ';
echo '
|---|
| ';
echo ' '; echo ' | ';
echo '