BioTorrents.de’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 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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">1 GiB Upload</a>
  52. </td>
  53. <td class="nobr">
  54. 1,300 <?=BONUS_POINTS?>
  55. </td>
  56. <td class="nobr">
  57. Purchase 1 GiB of upload
  58. </td>
  59. </tr>
  60. <tr class="row">
  61. <td class="nobr">
  62. <a href="store.php?item=upload_10GB">10 GiB Upload</a>
  63. </td>
  64. <td class="nobr">
  65. 13,000 <?=BONUS_POINTS?>
  66. </td>
  67. <td class="nobr">
  68. Purchase 10 GiB of upload
  69. </td>
  70. </tr>
  71. <tr class="row">
  72. <td class="nobr">
  73. <a href="store.php?item=upload_100GB">100 GiB Upload</a>
  74. </td>
  75. <td class="nobr">
  76. 130,000 <?=BONUS_POINTS?>
  77. </td>
  78. <td class="nobr">
  79. Purchase 100 GiB of upload
  80. </td>
  81. </tr>
  82. <tr class="row">
  83. <td class="nobr">
  84. <a href="store.php?item=upload_1000GB">1,000 GiB Upload</a>
  85. </td>
  86. <td class="nobr">
  87. 1,300,000 <?=BONUS_POINTS?>
  88. </td>
  89. <td class="nobr">
  90. Purchase 1,000 GiB 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.3 GiB 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. 13 GiB 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. 130 GiB 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,300 GiB 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. <tr class="row">
  171. <td class="nobr">
  172. <a href="store.php?item=freeleechpool">Freeleech Pool</a>
  173. </td>
  174. <td class="nobr">
  175. </td>
  176. <td class="nobr">
  177. Make a donation to the Freeleech Pool
  178. </td>
  179. </tr>
  180. </table>
  181. <br />
  182. <h4>Badges</h4>
  183. <table width="100%" class="store_table">
  184. <tr class="colhead">
  185. <td style="width: 100px;">Badge</td>
  186. <td style="width: 100px;">Cost</td>
  187. <!--<td style="width: 400px;">Description</td>-->
  188. </tr>
  189. <?
  190. $DB->query("
  191. SELECT ID AS BadgeID, Name, Description
  192. FROM badges
  193. WHERE ID IN (100, 101, 102, 103, 104, 105, 106, 107)");
  194. if ($DB->has_results()) {
  195. $Badges = $DB->to_array();
  196. foreach ($Badges as $ID => $Badge) {
  197. ?>
  198. <tr class="row">
  199. <?
  200. if (($ID == 0 || Badges::has_badge($LoggedUser['ID'], $Badges[$ID-1]['BadgeID'])) && !Badges::has_badge($LoggedUser['ID'], $Badge['BadgeID']))
  201. $BadgeText = '<a href="store.php?item=badge&badge='.$Badge['BadgeID'].'">'.$Badge['Name'].'</a>';
  202. else
  203. $BadgeText = $Badge['Name']
  204. ?>
  205. <td class="nobr"><?=Badges::display_badge($Badge['BadgeID'])?><span class="badge_name" style="margin-left: 10px;"><?=$BadgeText?></span></td>
  206. <td class="nobr"><?=$Badge['Description']?></td>
  207. </tr>
  208. <?
  209. }
  210. }
  211. $DB->query("
  212. SELECT ID AS BadgeID, Name, Description
  213. FROM badges
  214. WHERE Name='Oppaicoin'");
  215. if ($DB->has_results()) {
  216. $CoinBadge = $DB->to_array()[0];
  217. $BadgeText = '<a href="store.php?item=coinbadge">'.$CoinBadge['Name'].'</a>';
  218. ?>
  219. <tr class="row">
  220. <td class="nobr"><?=Badges::display_badge($CoinBadge['BadgeID'])?><span class="badge_name" style="margin-left: 10px;"><?=$BadgeText?></span></td>
  221. <td class="nobr"><?=$CoinBadge['Description']?></td>
  222. </tr>
  223. <? } ?>
  224. </table>
  225. </div>
  226. </div>
  227. <? View::show_footer(); ?>