Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 line
2.4 KiB

  1. <?php
  2. if (isset($_SESSION['userid'])) {
  3. // get all the character id's related to the selected account id's
  4. // $gci = Get Character ID's
  5. $gaccid = implode(", ", $_POST['delaccid']);
  6. $gci = $con->prepare("SELECT charid, accid FROM gwchars WHERE accid IN ($gaccid) AND userid = ?");
  7. $gci->bind_param("i", $_SESSION['userid']);
  8. $gci->execute();
  9. $gciresults = $gci->get_result();
  10. while ($gcirow = $gciresults->fetch_assoc()) {
  11. $delchar = $con->prepare("DELETE FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?");
  12. $delchar->bind_param("iii", $gcirow['charid'], $gcirow['accid'], $_SESSION['userid']);
  13. $delchar->execute();
  14. $delchar->close();
  15. // $dac = Delete Account Stats
  16. echo 'the error from $gcirow-accid is: <b>' . $gcirow['accid'] . '</b><br>';
  17. $dac = $con->prepare("DELETE FROM gwstats WHERE charid = 0 AND accid = ? AND userid = ?");
  18. $dac->bind_param("ii", $gcirow['accid'], $_SESSION['userid']);
  19. $dac->execute();
  20. $dac->close();
  21. // $dcs = Delete Character Stats
  22. $dcs = $con->prepare("DELETE FROM gwstats WHERE charid = ? AND accid = ? AND userid = ?");
  23. $dcs->bind_param("iii", $gcirow['charid'], $gcirow['accid'], $_SESSION['userid']);
  24. $dcs->execute();
  25. $dcs->close();
  26. }
  27. $gci->close();
  28. //this should be the last SQL query to run!
  29. $delacc = $con->prepare("DELETE FROM gwaccounts WHERE accid IN ($gaccid) AND userid = ?");
  30. $delacc->bind_param("i", $_SESSION['userid']);
  31. $delacc->execute();
  32. $delacc->close();
  33. // $nap = No Account Preference
  34. $nap = $con->prepare("UPDATE userinfo SET prefaccid = 0, prefaccname = 'No default selected' WHERE userid = ?");
  35. $nap->bind_param("i", $_SESSION['userid']);
  36. $nap->execute();
  37. $nap->close();
  38. $_SESSION['prefaccid'] = "0";
  39. $_SESSION['prefaccname'] = "No default selected";
  40. echo 'Account(s) deleted - no preferred account selected.<br /><br />';
  41. // $ncp = No Character Preference
  42. $ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?");
  43. $ncp->bind_param("i", $_SESSION['userid']);
  44. $ncp->execute();
  45. $ncp->close();
  46. $_SESSION['prefcharid'] = "0";
  47. $_SESSION['prefcharname'] = "No default selected";
  48. $_SESSION['charprofid'] = "0";
  49. echo 'All characters related to the account have been deleted - no preferred character selected.<br /><br />';
  50. }
  51. ?>