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.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

59 rader
2.9 KiB

  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <link rel="stylesheet" type="text/css" href="gw-style.css">
  5. <TITLE>Inserting Data</TITLE>
  6. </HEAD>
  7. <?php
  8. session_start();
  9. include_once 'gw-connect.php';
  10. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  11. #non-section specific POST data here
  12. $gold = mysqli_real_escape_string($con, $_POST['droppedgold']); //how much gold dropped
  13. $droptype = mysqli_real_escape_string($con, $_POST['droptype']); //this dictates if the drop was a weapon/rune/material
  14. $locid = mysqli_real_escape_string($con, $_POST['location']); //this is `treasurelocation`.`treasureid` in the database
  15. $toonid = $_SESSION['playerid'];
  16. $uid = $_SESSION['userid'];
  17. $treasdate = mysqli_real_escape_string($con, $_POST['treasuredate']);
  18. if ($droptype == 1){
  19. $rarity = mysqli_real_escape_string($con, $_POST['rare']);
  20. $req = mysqli_real_escape_string($con, $_POST['requirement']);
  21. $attrib = mysqli_real_escape_string($con, $_POST['attribute']);
  22. $weap = mysqli_real_escape_string($con, $_POST['weapon']);
  23. $itname = mysqli_real_escape_string($con, $_POST['itemname']);
  24. $sqlweapins = "INSERT INTO `history` (historydate, userid, charnameid, locationid, goldrec, itemreq, itemtype, itemattribute, itemrarity, itemname) VALUES ('$treasdate', $uid, $toonid, $locid, $gold, $req, $weap, $attrib, $rarity, '$itname')";
  25. if (!$result = $con->query($sqlweapins)){
  26. die ('There was an error running the query [' . $con->error . ']');
  27. }
  28. } else if ($droptype == 2){
  29. $matid = mysqli_real_escape_string($con, $_POST['rarematerial']);
  30. $sqlmatins = "INSERT INTO `history` (historydate, userid, charnameid, locationid, goldrec, material) VALUES ('$treasdate', $uid, $toonid, $locid, $gold, $matid)";
  31. if (!$result = $con->query($sqlmatins)){
  32. die ('There was an error running the query [' . $con->error . ']');
  33. }
  34. } else if ($droptype == 3){
  35. $runeid = mysqli_real_escape_string($con, $_POST['rune']);
  36. $runerare = mysqli_real_escape_string($con, $_POST['runerarity']);
  37. $sqlruneins = "INSERT INTO `history` (historydate, userid, charnameid, locationid, goldrec, itemtype, itemrarity, runetype) VALUES ('$treasdate', $uid, $toonid, $locid, $gold, '16', $runerare, $runeid)";
  38. if (!$result = $con->query($sqlruneins)){
  39. die ('There was an error running the query [' . $con->error . ']');
  40. }
  41. } else if ($droptype == 4){
  42. $itname = mysqli_real_escape_string($con, $_POST['itemname']);
  43. $itnothing = mysqli_real_escape_string($con, $_POST['itemtype']);
  44. $sqlnothing = "INSERT INTO `history` (historydate, userid, charnameid, locationid, goldrec, itemtype, itemname) VALUES ('$treasdate', $uid, $toonid, $locid, $gold, $itnothing, '$itname')";
  45. if (!$result = $con->query($sqlnothing)){
  46. die ('There was an error running the query [' . $con->error . ']');
  47. }
  48. } else {
  49. exit("Variable droptype was set to ($droptype)");
  50. }
  51. ?>
  52. <BODY onload="document.returntotoons.submit()">
  53. <CENTER>
  54. <FORM METHOD="POST" ACTION="gw-toon.php" NAME="returntotoons">
  55. <INPUT TYPE="SUBMIT">
  56. </FORM>
  57. </CENTER>
  58. </BODY>
  59. </HTML>