Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

43 Zeilen
2.3 KiB

  1. <?php
  2. if (isset($_SESSION['userid'])) {
  3. // check to see if we're going to INSERT or UPDATE a row
  4. // $cfr = Check For Results
  5. $cfr = $con->prepare("SELECT COUNT(*) FROM gwstats WHERE charid = ? AND titlenameid = ? AND accid = ? AND userid = ?");
  6. $cfr->bind_param("iiii", $_SESSION['prefcharid'], $_POST['titlenameid'], $_SESSION['prefaccid'], $_SESSION['userid']);
  7. $cfr->execute();
  8. $cfr->bind_result($r1);
  9. $cfr->fetch();
  10. $cfr->close();
  11. // $gcr = Get Current Rank
  12. $gcr = $con->prepare("SELECT stnameid, stname, strank FROM gwsubtitles WHERE titlenameid = ? AND stpoints <= ? ORDER BY stpoints DESC LIMIT 1");
  13. $gcr->bind_param("ii", $_POST['titlenameid'], $_POST['titlepoints']);
  14. $gcr->execute();
  15. $gcr->bind_result($stnameid, $stname, $strank);
  16. $gcr->fetch();
  17. $gcr->close();
  18. // $gpc = Get Percentage Completed
  19. $gpc = $con->prepare("SELECT stpoints FROM gwsubtitles WHERE titlenameid = ? ORDER BY stnameid DESC LIMIT 1");
  20. $gpc->bind_param("i", $_POST['titlenameid']);
  21. $gpc->execute();
  22. $gpc->bind_result($pmr); //$pmr = Percentage Max Rank
  23. $gpc->fetch();
  24. $gpc->close();
  25. $progress = ceil(($_POST['titlepoints'] / $pmr) * 100);
  26. if ($r1 > 0) {
  27. // $urs = Update Rank Stats
  28. $urs = $con->prepare("UPDATE gwstats SET stnameid = ?, titlepoints = ?, currentstrankname = ?, currentstrank = ?, percent = ? WHERE charid = ? AND titlenameid = ? AND accid = ? AND userid = ?");
  29. $urs->bind_param("iisiiiiii", $stnameid, $_POST['titlepoints'], $stname, $strank, $progress, $_SESSION['prefcharid'], $_POST['titlenameid'], $_SESSION['prefaccid'], $_SESSION['userid']);
  30. $urs->execute();
  31. $urs->close();
  32. echo 'Title has been updated!<br /><br />';
  33. } else {
  34. // $irs = Insert Rank Stats
  35. $irs = $con->prepare("INSERT INTO gwstats (titlenameid, stnameid, titlepoints, currentstrankname, currentstrank, percent, charid, accid, userid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
  36. $irs->bind_param("iiisiiiii", $_POST['titlenameid'], $stnameid, $_POST['titlepoints'], $stname, $strank, $progress, $_SESSION['prefcharid'], $_SESSION['prefaccid'], $_SESSION['userid']);
  37. $irs->execute();
  38. $irs->close();
  39. echo 'Title entered!<br /></br />';
  40. }
  41. include_once ('update-gwamm.php');
  42. }
  43. ?>