Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

store.php 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <?
  2. $UserID = $LoggedUser['ID'];
  3. $PermID = $LoggedUser['PermissionID'];
  4. if (!$LoggedUser['DisablePoints']) {
  5. $PointsRate = 0;
  6. $getTorrents = $DB->query("
  7. SELECT um.BonusPoints,
  8. COUNT(DISTINCT x.fid) AS Torrents,
  9. SUM(t.Size) AS Size,
  10. SUM(xs.seedtime) AS Seedtime,
  11. SUM(t.Seeders) AS Seeders
  12. FROM users_main AS um
  13. LEFT JOIN users_info AS i on um.ID = i.UserID
  14. LEFT JOIN xbt_files_users AS x ON um.ID=x.uid
  15. LEFT JOIN torrents AS t ON t.ID=x.fid
  16. LEFT JOIN xbt_snatched AS xs ON x.uid=xs.uid AND x.fid=xs.fid
  17. WHERE
  18. um.ID = ?
  19. AND um.Enabled = '1'
  20. AND x.active = 1
  21. AND x.completed = 0
  22. AND x.Remaining = 0
  23. GROUP BY um.ID", $UserID);
  24. if ($DB->has_results()) {
  25. list($BonusPoints, $NumTorr, $TSize, $TTime, $TSeeds) = $DB->next_record();
  26. $PointsRate = (0.5 + (0.55*($NumTorr * (sqrt(($TSize/$NumTorr)/1073741824) * pow(1.5,($TTime/$NumTorr)/(24*365))))) / (max(1, sqrt(($TSeeds/$NumTorr)+4)/3)))**0.95;
  27. }
  28. $PointsRate = intval(max(min($PointsRate, ($PointsRate * 2) - ($BonusPoints/1440)), 0));
  29. $PointsPerHour = number_format($PointsRate) . " ".BONUS_POINTS."/hour";
  30. $PointsPerDay = number_format($PointsRate*24) . " ".BONUS_POINTS."/day";
  31. } else {
  32. $PointsPerHour = "0 ".BONUS_POINTS."/hour";
  33. $PointsPerDay = BONUS_POINTS." disabled";
  34. }
  35. //Include the header
  36. View::show_header('Store');
  37. ?>
  38. <div class="thin">
  39. <h2 id="general">Store</h2>
  40. <div class="box pad">
  41. <h3 id="lists" class="float_left">You have <?=number_format($LoggedUser['BonusPoints'])?> <?=BONUS_POINTS?> to spend</h3>
  42. <h3 id="lists" class="float_right">You're making <?=$PointsPerHour?> (<?=$PointsPerDay?>)</h3>
  43. <table width="100%" class="store_table">
  44. <tr class="colhead">
  45. <td style="width: 100px;">Item</td>
  46. <td style="width: 100px;">Cost</td>
  47. <td style="width: 400px;">Description</td>
  48. </tr>
  49. <tr class="row">
  50. <td class="nobr">
  51. <a href="store.php?item=upload_1GB">1GiB Upload</a>
  52. </td>
  53. <td class="nobr">
  54. 1,300 <?=BONUS_POINTS?>
  55. </td>
  56. <td class="nobr">
  57. Purchase 1GiB of upload
  58. </td>
  59. </tr>
  60. <tr class="row">
  61. <td class="nobr">
  62. <a href="store.php?item=upload_10GB">10GiB Upload</a>
  63. </td>
  64. <td class="nobr">
  65. 13,000 <?=BONUS_POINTS?>
  66. </td>
  67. <td class="nobr">
  68. Purchase 10GiB of upload
  69. </td>
  70. </tr>
  71. <tr class="row">
  72. <td class="nobr">
  73. <a href="store.php?item=upload_100GB">100GiB Upload</a>
  74. </td>
  75. <td class="nobr">
  76. 130,000 <?=BONUS_POINTS?>
  77. </td>
  78. <td class="nobr">
  79. Purchase 100GiB of upload
  80. </td>
  81. </tr>
  82. <tr class="row">
  83. <td class="nobr">
  84. <a href="store.php?item=upload_1000GB">1,000GiB Upload</a>
  85. </td>
  86. <td class="nobr">
  87. 1,300,000 <?=BONUS_POINTS?>
  88. </td>
  89. <td class="nobr">
  90. Purchase 1,000GiB of upload
  91. </td>
  92. </tr>
  93. <tr class="row">
  94. <td class="nobr">
  95. <a href="store.php?item=1k_points">1,000 <?=BONUS_POINTS?></a>
  96. </td>
  97. <td class="nobr">
  98. 1.3GiB Upload
  99. </td>
  100. <td class="nobr">
  101. Purchase 1,000 <?=BONUS_POINTS?>
  102. </td>
  103. </tr>
  104. <tr class="row">
  105. <td class="nobr">
  106. <a href="store.php?item=10k_points">10,000 <?=BONUS_POINTS?></a>
  107. </td>
  108. <td class="nobr">
  109. 13GiB Upload
  110. </td>
  111. <td class="nobr">
  112. Purchase 10,000 <?=BONUS_POINTS?>
  113. </td>
  114. </tr>
  115. <tr class="row">
  116. <td class="nobr">
  117. <a href="store.php?item=100k_points">100,000 <?=BONUS_POINTS?></a>
  118. </td>
  119. <td class="nobr">
  120. 130GiB Upload
  121. </td>
  122. <td class="nobr">
  123. Purchase 100,000 <?=BONUS_POINTS?>
  124. </td>
  125. </tr>
  126. <tr class="row">
  127. <td class="nobr">
  128. <a href="store.php?item=1m_points">1,000,000 <?=BONUS_POINTS?></a>
  129. </td>
  130. <td class="nobr">
  131. 1,300GiB Upload
  132. </td>
  133. <td class="nobr">
  134. Purchase 1,000,000 <?=BONUS_POINTS?>
  135. </td>
  136. </tr>
  137. <tr class="row">
  138. <td class="nobr">
  139. <a href="store.php?item=freeleechize">Freeleechize</a>
  140. </td>
  141. <td class="nobr">
  142. 20,000 <?=BONUS_POINTS?>
  143. </td>
  144. <td class="nobr">
  145. Make a torrent freeleech (to everyone) for 24 hours
  146. </td>
  147. </tr>
  148. <tr class="row">
  149. <td class="nobr">
  150. <a href="store.php?item=title">Custom Title</a>
  151. </td>
  152. <td class="nobr">
  153. 50,000 <?=BONUS_POINTS?>
  154. </td>
  155. <td class="nobr">
  156. Purchase a custom title
  157. </td>
  158. </tr>
  159. <tr class="row">
  160. <td class="nobr">
  161. <a href="store.php?item=invite">Invite</a>
  162. </td>
  163. <td class="nobr">
  164. 100,000 <?=BONUS_POINTS?>
  165. </td>
  166. <td class="nobr">
  167. Purchase an invite for your friend
  168. </td>
  169. </tr>
  170. <? switch ($PermID) {
  171. case USER:
  172. $To = array('Modest Mounds', '1,000');
  173. break;
  174. case MEMBER:
  175. $To = array('Well Endowed', '10,000');
  176. break;
  177. case POWER:
  178. $To = array('Bombshell', '30,000');
  179. break;
  180. case ELITE:
  181. $To = array('Top Heavy', '60,000');
  182. break;
  183. case TORRENT_MASTER:
  184. $To = array('Titty Monster', '100,000');
  185. break;
  186. }
  187. if (isset($To)) { ?>
  188. <tr class="row">
  189. <td class="nobr">
  190. <a href="store.php?item=promotion">Promotion</a>
  191. </td>
  192. <td class="nobr">
  193. <?=$To[1]." ".BONUS_POINTS?>
  194. </td>
  195. <td class="nobr">
  196. Get promoted to <?=$To[0]?>
  197. </td>
  198. </tr>
  199. <? } ?>
  200. <tr class="row">
  201. <td class="nobr">
  202. <a href="store.php?item=become_admin">Become Admin</a>
  203. </td>
  204. <td class="nobr">
  205. 4,294,967,296 <?=BONUS_POINTS?>
  206. </td>
  207. <td class="nobr">
  208. Have your class changed to Sysop
  209. </td>
  210. </tr>
  211. <tr class="row">
  212. <td class="nobr">
  213. <a href="store.php?item=freeleechpool">Freeleech Pool</a>
  214. </td>
  215. <td class="nobr">
  216. </td>
  217. <td class="nobr">
  218. Make a donation to the Freeleech Pool
  219. </td>
  220. </tr>
  221. </table>
  222. <br />
  223. <h4>Badges</h4>
  224. <table width="100%" class="store_table">
  225. <tr class="colhead">
  226. <td style="width: 100px;">Badge</td>
  227. <td style="width: 100px;">Cost</td>
  228. <!--<td style="width: 400px;">Description</td>-->
  229. </tr>
  230. <?
  231. $DB->query("
  232. SELECT ID AS BadgeID, Name, Description
  233. FROM badges
  234. WHERE ID IN (100, 101, 102, 103, 104, 105, 106, 107)");
  235. if ($DB->has_results()) {
  236. $Badges = $DB->to_array();
  237. foreach ($Badges as $ID => $Badge) {
  238. ?>
  239. <tr class="row">
  240. <?
  241. if (($ID == 0 || Badges::has_badge($LoggedUser['ID'], $Badges[$ID-1]['BadgeID'])) && !Badges::has_badge($LoggedUser['ID'], $Badge['BadgeID']))
  242. $BadgeText = '<a href="store.php?item=badge&badge='.$Badge['BadgeID'].'">'.$Badge['Name'].'</a>';
  243. else
  244. $BadgeText = $Badge['Name']
  245. ?>
  246. <td class="nobr"><?=Badges::display_badge($Badge['BadgeID'])?><span class="badge_name" style="margin-left: 10px;"><?=$BadgeText?></span></td>
  247. <td class="nobr"><?=$Badge['Description']?></td>
  248. </tr>
  249. <?
  250. }
  251. }
  252. $DB->query("
  253. SELECT ID AS BadgeID, Name, Description
  254. FROM badges
  255. WHERE Name='Oppaicoin'");
  256. if ($DB->has_results()) {
  257. $CoinBadge = $DB->to_array()[0];
  258. $BadgeText = '<a href="store.php?item=coinbadge">'.$CoinBadge['Name'].'</a>';
  259. ?>
  260. <tr class="row">
  261. <td class="nobr"><?=Badges::display_badge($CoinBadge['BadgeID'])?><span class="badge_name" style="margin-left: 10px;"><?=$BadgeText?></span></td>
  262. <td class="nobr"><?=$CoinBadge['Description']?></td>
  263. </tr>
  264. <? } ?>
  265. </table>
  266. </div>
  267. </div>
  268. <? View::show_footer(); ?>