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.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

52 rindas
2.5 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, charnameid, locationid, goldrec, material) VALUES ('$treasdate', $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, charnameid, locationid, goldrec, itemtype, itemrarity, runetype) VALUES ('$treasdate', $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 {
  42. exit("Variable droptype was set to ($droptype)");
  43. }
  44. ?>
  45. <BODY onload="document.returntotoons.submit()">
  46. <CENTER>
  47. <FORM METHOD="POST" ACTION="gw-toon.php" NAME="returntotoons">
  48. <INPUT TYPE="SUBMIT">
  49. </FORM>
  50. </CENTER>
  51. </BODY>
  52. </HTML>