| @@ -16,12 +16,12 @@ if (isset($_SESSION['userid'])) { | |||||
| $dac = $con->prepare("DELETE FROM gwaccstats WHERE accid = ? AND userid = ?"); | $dac = $con->prepare("DELETE FROM gwaccstats WHERE accid = ? AND userid = ?"); | ||||
| $dac->bind_param("ii", $gcirow['accid'], $_SESSION['userid']); | $dac->bind_param("ii", $gcirow['accid'], $_SESSION['userid']); | ||||
| $dac->execute(); | $dac->execute(); | ||||
| $dac->close();/* | |||||
| $dac->close(); | |||||
| // $dcs = Delete Character Stats | // $dcs = Delete Character Stats | ||||
| $dcs = $con->prepare("DELETE FROM gwcharstats WHERE charid = ? AND accid = ? AND userid = ?"); | $dcs = $con->prepare("DELETE FROM gwcharstats WHERE charid = ? AND accid = ? AND userid = ?"); | ||||
| $dcs->bind_param("iii", $gcirow['charid'], $gcirow['accid'], $_SESSION['userid']); | $dcs->bind_param("iii", $gcirow['charid'], $gcirow['accid'], $_SESSION['userid']); | ||||
| $dcs->execute(); | $dcs->execute(); | ||||
| $dcs->close(); */ | |||||
| $dcs->close(); | |||||
| } | } | ||||
| $gci->close(); | $gci->close(); | ||||
| //this should be the last SQL query to run! | //this should be the last SQL query to run! | ||||
| @@ -9,7 +9,13 @@ if (isset($_SESSION['userid'])) { | |||||
| } | } | ||||
| $delchar->close(); | $delchar->close(); | ||||
| } | } | ||||
| // need to delete associate character stats as well. TODO | |||||
| // $dcs = Delete Character Stats | |||||
| $gcharid = implode(", ", $_POST['delcharid']); | |||||
| $dcs = $con->prepare("DELETE FROM gwcharstats WHERE charid IN ($gcharid) AND accid = ? AND userid = ?"); | |||||
| $dcs->bind_param("ii", $_SESSION['prefaccid'], $_SESSION['userid']); | |||||
| $dcs->execute(); | |||||
| $dcs->close(); | |||||
| // set preferred character to none | |||||
| $nap = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | $nap = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | ||||
| $nap->bind_param("i", $_SESSION['userid']); | $nap->bind_param("i", $_SESSION['userid']); | ||||
| $nap->execute(); | $nap->execute(); | ||||
| @@ -69,8 +69,7 @@ if (isset($_SESSION['userid'])){ | |||||
| } | } | ||||
| </script> | </script> | ||||
| <input type="submit" name="submission" value="Update password" onclick="return Validate()" id="btnSubmit"></form> | <input type="submit" name="submission" value="Update password" onclick="return Validate()" id="btnSubmit"></form> | ||||
| UPDPASS; | |||||
| } | |||||
| UPDPASS; | |||||
| } | } | ||||
| include_once ('footer.php'); | include_once ('footer.php'); | ||||
| ?> | ?> | ||||
| @@ -5,7 +5,11 @@ if (isset($_SESSION['userid'])) { | |||||
| if (!isset($_POST['chartitle'])) { | if (!isset($_POST['chartitle'])) { | ||||
| $_POST['chartitle'] = "notselected"; | $_POST['chartitle'] = "notselected"; | ||||
| } | } | ||||
| if ($_SESSION['prefcharid'] == "0") { | |||||
| echo 'Please select a character from the menu above to add stats to before continuing'; | |||||
| include_once ('footer.php'); | |||||
| exit(); | |||||
| } | |||||
| if (isset($_POST['titlepoints'])) { | if (isset($_POST['titlepoints'])) { | ||||
| // include file just updates the database | // include file just updates the database | ||||
| include_once ('includes/update-chartitleranks.php'); | include_once ('includes/update-chartitleranks.php'); | ||||
| @@ -15,7 +19,7 @@ if (isset($_SESSION['userid'])) { | |||||
| echo '<form action="updatecharstats.php" method="post">'; | echo '<form action="updatecharstats.php" method="post">'; | ||||
| echo 'Select character title to update: <select name="chartitle" onchange="this.form.submit()">'; | echo 'Select character title to update: <select name="chartitle" onchange="this.form.submit()">'; | ||||
| // $cts = Character Title Select | // $cts = Character Title Select | ||||
| $cts = $con->prepare("SELECT titlenameid, titlename FROM gwtitles WHERE titletype = 1 ORDER BY titlename"); | |||||
| $cts = $con->prepare("SELECT titlenameid, titlename FROM gwtitles WHERE titletype = 1 AND autofilled = 0 ORDER BY titlename"); | |||||
| $cts->execute(); | $cts->execute(); | ||||
| $result = $cts->get_result(); | $result = $cts->get_result(); | ||||
| while ($row = $result->fetch_assoc()) { | while ($row = $result->fetch_assoc()) { | ||||