Just a web script to help track when, where, and what you got from the free treasures scattered about Nightfall in the game Guild Wars.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

40 рядки
2.5 KiB

  1. <?php
  2. session_start();
  3. include_once 'gw-connect.php';
  4. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  5. #non-section specific POST data here
  6. $gold = mysqli_real_escape_string($con, $_POST['droppedgold']); //how much gold dropped
  7. $droptype = mysqli_real_escape_string($con, $_POST['droptype']); //this dictates if the drop was a weapon/rune/material
  8. $locid = mysqli_real_escape_string($con, $_POST['location']); //this is `treasurelocation`.`treasureid` in the database
  9. //$toonid = mysqli_real_escape_string($con, $_POST['chartoon']); //this is the id of the character doing the hunting
  10. $toonid = $_SESSION['playerid'];
  11. $treasdate = mysqli_real_escape_string($con, $_POST['treasuredate']);
  12. if ($droptype == 1){
  13. $rarity = mysqli_real_escape_string($con, $_POST['rare']);
  14. $req = mysqli_real_escape_string($con, $_POST['requirement']);
  15. $attrib = mysqli_real_escape_string($con, $_POST['attribute']);
  16. $weap = mysqli_real_escape_string($con, $_POST['weapon']);
  17. $itname = mysqli_real_escape_string($con, $_POST['itemname']);
  18. $sqlweapins = "INSERT INTO `history` (historydate, charnameid, locationid, goldrec, itemreq, itemtype, itemattribute, itemrarity, itemname) VALUES ('$treasdate', $toonid, $locid, $gold, $req, $weap, $attrib, $rarity, '$itname')";
  19. if (!$result = $con->query($sqlweapins)){
  20. die ('There was an error running the query [' . $con->error . ']');
  21. }
  22. } else if ($droptype == 2){
  23. $matid = mysqli_real_escape_string($con, $_POST['rarematerial']);
  24. $sqlmatins = "INSERT INTO `history` (historydate, charnameid, locationid, goldrec, material) VALUES (\"$treasdate\", $toonid, $locid, $gold, $matid)";
  25. if (!$result = $con->query($sqlmatins)){
  26. die ('There was an error running the query [' . $con->error . ']');
  27. }
  28. } else if ($droptype == 3){
  29. $runeid = mysqli_real_escape_string($con, $_POST['rune']);
  30. $runerare = mysqli_real_escape_string($con, $_POST['runerarity']);
  31. $sqlruneins = "INSERT INTO `history` (historydate, charnameid, locationid, goldrec, itemtype, itemrarity, runetype) VALUES ('$treasdate', $toonid, $locid, $gold, '16', $runerare, $runeid)";
  32. if (!$result = $con->query($sqlruneins)){
  33. die ('There was an error running the query [' . $con->error . ']');
  34. }
  35. } else {
  36. exit("Variable droptype was set to ($droptype)");
  37. }
  38. echo '<BODY onload="document.returntotoons.submit()">';
  39. echo '<FORM METHOD="POST" ACTION="gw-toon.php" NAME="returntotoons"><INPUT TYPE="HIDDEN" NAME="cnameid" VALUE="'. $toonid . '"><INPUT TYPE="SUBMIT"></FORM></BODY>';
  40. ?>