From 298c09ce6cccaa48b20140f419e07e9394323413 Mon Sep 17 00:00:00 2001 From: mauirixxx Date: Fri, 17 Aug 2018 16:44:02 -1000 Subject: [PATCH] deleting an account deletes ALL characters from the account, and ALL stats related to both the account and characters --- includes/del-account.php | 4 ++-- includes/del-character.php | 8 +++++++- preferences.php | 3 +-- updatecharstats.php | 8 ++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/includes/del-account.php b/includes/del-account.php index 1463964..2455388 100644 --- a/includes/del-account.php +++ b/includes/del-account.php @@ -16,12 +16,12 @@ if (isset($_SESSION['userid'])) { $dac = $con->prepare("DELETE FROM gwaccstats WHERE accid = ? AND userid = ?"); $dac->bind_param("ii", $gcirow['accid'], $_SESSION['userid']); $dac->execute(); - $dac->close();/* + $dac->close(); // $dcs = Delete Character Stats $dcs = $con->prepare("DELETE FROM gwcharstats WHERE charid = ? AND accid = ? AND userid = ?"); $dcs->bind_param("iii", $gcirow['charid'], $gcirow['accid'], $_SESSION['userid']); $dcs->execute(); - $dcs->close(); */ + $dcs->close(); } $gci->close(); //this should be the last SQL query to run! diff --git a/includes/del-character.php b/includes/del-character.php index 706b93a..44c12d4 100644 --- a/includes/del-character.php +++ b/includes/del-character.php @@ -9,7 +9,13 @@ if (isset($_SESSION['userid'])) { } $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->bind_param("i", $_SESSION['userid']); $nap->execute(); diff --git a/preferences.php b/preferences.php index b99bc25..7ede41b 100644 --- a/preferences.php +++ b/preferences.php @@ -69,8 +69,7 @@ if (isset($_SESSION['userid'])){ } - UPDPASS; - } +UPDPASS; } include_once ('footer.php'); ?> \ No newline at end of file diff --git a/updatecharstats.php b/updatecharstats.php index fb68ac6..596f1ad 100644 --- a/updatecharstats.php +++ b/updatecharstats.php @@ -5,7 +5,11 @@ if (isset($_SESSION['userid'])) { if (!isset($_POST['chartitle'])) { $_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'])) { // include file just updates the database include_once ('includes/update-chartitleranks.php'); @@ -15,7 +19,7 @@ if (isset($_SESSION['userid'])) { echo '
'; echo 'Select character title to update: