Advertisement
Guest User

Untitled

a guest
Dec 18th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. <?php
  2. include "globals.php";
  3. if(!$_GET['spend'])
  4. {
  5. print "Welcome to the crystal temple!<br />
  6. You have <b>{$ir['crystals']}</b> crystals.<br />
  7. What would you like to spend your crystals on?<br />
  8. <br />
  9. <a href='crystaltemple.php?spend=refill'>Energy Refill - {$set['ct_refillprice']} Crystals</a><br />
  10. <a href='crystaltemple.php?spend=IQ'>IQ - {$set['ct_iqpercrys']} IQ per crystal</a><br />
  11. <a href='crystaltemple.php?spend=money'>Money - \$".number_format($set['ct_moneypercrys'])." per crystal</a><br />";
  12. }
  13.  
  14. if($_GET['spend'] == 'brefill')
  15. {
  16. if($ir['crystals'] <$set['br_refillprice'])
  17. {
  18. print "You don't have enough crystals!";
  19. }
  20. else if($ir['brave'] == $ir['maxbrave'])
  21. {
  22. print "You already have full energy.";
  23. }
  24.  
  25. if($_GET['spend'] == 'refill')
  26. {
  27. if($ir['crystals'] <$set['ct_refillprice'])
  28. {
  29. print "You don't have enough crystals!";
  30. }
  31. else if($ir['energy'] == $ir['maxenergy'])
  32. {
  33. print "You already have full energy.";
  34. }
  35. else
  36. {
  37. $db->query("UPDATE users SET energy=maxenergy,crystals=crystals-{$set['ct_refillprice']} WHERE userid=$userid");
  38. print "You have paid {$set['ct_refillprice']} crystals to refill your energy bar.";
  39. }
  40. }
  41. else if($_GET['spend'] == 'IQ')
  42. {
  43. print "Type in the amount of crystals you want to swap for IQ.<br />
  44. You have <b>{$ir['crystals']}</b> crystals.<br />
  45. One crystal = {$set['ct_iqpercrys']} IQ.<form action='crystaltemple.php?spend=IQ2' method='post'><input type='text' name='crystals' /><br /><input type='submit' value='Swap' /></form>";
  46. }
  47. else if($_GET['spend'] == 'IQ2')
  48. {
  49. $_POST['crystals']=(int) $_POST['crystals'];
  50. if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals'])
  51. {
  52. print "Error, you either do not have enough crystals or did not fill out the form.<br />
  53. <a href='crystaltemple.php?spend=IQ'>Back</a>";
  54. }
  55. else
  56. {
  57. $iqgain=$_POST['crystals']*$set['ct_iqpercrys'];
  58. $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid");
  59. $db->query("UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid");
  60. print "You traded {$_POST['crystals']} crystals for $iqgain IQ.";
  61. }
  62. }
  63. else if($_GET['spend'] == 'money')
  64. {
  65. print "Type in the amount of crystals you want to swap for money.<br />
  66. You have <b>{$ir['crystals']}</b> crystals.<br />
  67. One crystal = \$".number_format($set['ct_moneypercrys']).".<form action='crystaltemple.php?spend=money2' method='post'><input type='text' name='crystals' /><br /><input type='submit' value='Swap' /></form>";
  68. }
  69. else if($_GET['spend'] == 'money2')
  70. {
  71. $_POST['crystals']=(int) $_POST['crystals'];
  72. if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals'])
  73. {
  74. print "Error, you either do not have enough crystals or did not fill out the form.<br />
  75. <a href='crystaltemple.php?spend=money'>Back</a>";
  76. }
  77. else
  78. {
  79. $iqgain=$_POST['crystals']*$set['ct_moneypercrys'];
  80. $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$iqgain WHERE userid=$userid");
  81. print "You traded {$_POST['crystals']} crystals for \$".number_format($iqgain).".";
  82. }
  83. }
  84. }p
  85.  
  86. $h->endpage();
  87. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement