Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3.  
  4. <?php
  5. //http://semantic-ui.com/collections/table.html
  6. // Configuration
  7. $hostname = 'projectpactscripting.com';
  8. $username = 'ProjectPact';
  9. $password = 'password';
  10. $database = 'AIO_Hunter';
  11.  
  12. function formatTime($time){
  13. $time_seconds = $time / 1000;
  14. $time_minutes = $time_seconds / 60;
  15. $time_hours = $time_minutes / 60;
  16. $time_days = floor($time_hours / 24);
  17. $seconds = $time_seconds % 60;
  18. $minutes = $time_minutes % 60;
  19. $hours = $time_hours % 24;
  20.  
  21. $days = floor($time_days % 365);
  22. $years = floor($time_days / 365);
  23. return $years . "y " . $days . "d " .$hours . "h " . $minutes . "m ";
  24. }
  25.  
  26.  
  27. try {
  28. $dbh = new PDO('mysql:host='. $hostname .';dbname='. $database, $username, $password);
  29. } catch(PDOException $e) {
  30. echo '<h1>An error has occurred.</h1><pre>', $e->getMessage() ,'</pre>';
  31. }
  32.  
  33. $sth = $dbh->query('SELECT * FROM Data ORDER BY timeran DESC');
  34. $sth->setFetchMode(PDO::FETCH_ASSOC);
  35.  
  36. $result = $sth->fetchAll();
  37. ?>
  38. <html>
  39. <head>
  40.  
  41. <title>Highscores</title>
  42. <link rel="stylesheet" type="text/css" href="http://ctrl.software/semantic/dist/semantic.min.css">
  43. <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  44. <script src="http://projectpactscripting.com/src/scripts/stupidtable.min.js"></script>
  45. <script src="http://ctrl.software/semantic/dist/semantic.min.js"></script>
  46.  
  47. </head>
  48. <body>
  49. <br>
  50. <div style="text-align:center;"><img src="http://i.imgur.com/e9RmCeC.png"></div>
  51.  
  52. <br>
  53. <p style="text-align: center;"><span style="font-size:24px;"><a href="http://www.projectpactscripting.com/AIO_Hunter.php">Home</a></span></p>
  54. <br>
  55. <br>
  56. <div class="ui container">
  57. <table class="ui fluid selectable celled sortable green table">
  58. <thead>
  59. <tr>
  60. <th data-sort="int" id="rank">
  61. Rank
  62. <i class="caret down icon" id="rankUp"></i>
  63. <i class="caret up icon" id="rankDown"></i>
  64. </th>
  65. <th data-sort="int" id="user">
  66. Username
  67. <i class="caret down icon" id="userUp"></i>
  68. <i class="caret up icon" id="userDown"></i>
  69. </th>
  70. <th data-sort="int" id="time">
  71. Time Ran
  72. <i class="caret down icon" id="timeUp"></i>
  73. <i class="caret up icon" id="timeDown"></i>
  74. </th>
  75. <th data-sort="int" id="xp">
  76. Exp Gained
  77. <i class="caret down icon" id="xpUp"></i>
  78. <i class="caret up icon" id="xpDown"></i>
  79. </th>
  80. <th data-sort="int" id="npc">
  81. NPCs Caught
  82. <i class="caret down icon" id="npcUp"></i>
  83. <i class="caret up icon" id="npcDown"></i>
  84. </th>
  85. <th data-sort="int" id="profit">
  86. Profit
  87. <i class="caret down icon" id="profitUp"></i>
  88. <i class="caret up icon" id="profitDown"></i>
  89. </th>
  90. </tr>
  91. </thead>
  92. <tbody>
  93. <?php
  94. if(count($result) > 0) {
  95. $rank = 1;
  96. foreach($result as $r) {
  97. echo '<tr>';
  98. echo '<td data-sort-value"'.$rank.'">'.$rank.'</td>';
  99. echo '<td data-sort-value"'.$r['Username'].'">'.$r['Username'].'</td>';
  100. echo '<td data-sort-value"'.$r['timeran'].'">'.formatTime($r['timeran']).'</td>';
  101. echo '<td data-sort-value"'.$r['expgained'].'">'.number_format($r['expgained']).'</td>';
  102. echo '<td data-sort-value"'.$r['NPC_Caught'].'">'.number_format($r['NPC_Caught']).'</td>';
  103. echo '<td data-sort-value"'.$r['profit'].'">'.number_format($r['profit']).'</td>';
  104. echo '</tr>';
  105.  
  106. $rank++;
  107. }
  108. }
  109. ?>
  110. </tbody>
  111. <tfoot class="full-width">
  112. <tr>
  113. <th></th>
  114. <th colspan="6">
  115.  
  116. </th>
  117. </tr>
  118. </tfoot>
  119. </table>
  120. </body>
  121.  
  122. <br>
  123.  
  124. <div id="footer">
  125. <p style="text-align: center;"><span style="color:#000000;">Made by: ProjectPact &nbsp;| &nbsp;Copyright &copy;. All Rights Reserved.</span></p>
  126. <br>
  127. </div>
  128. <script>
  129. $('#mytable').stupidtable();
  130.  
  131. $('#rank,#user,#time,#xp,#npc,#profit').click(new function(event) {
  132. console.log(event);
  133. if($('#'+event.target.id+'Down').is(':visible')) {
  134. $('#'+event.target.id+'Down').hide();
  135. $('#'+event.target.id+'Up').show();
  136. } else {
  137. $('.caret').hide();
  138. $('#'+event.target.id+'Down').show();
  139. }
  140.  
  141.  
  142. });
  143. $('#rank').click();
  144. </script>
  145. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement