Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 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://ctrl.software/Stupid-Table/stupidtable.min.js"></script>
  44. <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  45. <script src="http://semantic-ui.com/javascript/library/tablesort.js"></script>
  46. <script src="http://ctrl.software/Stupid-Table/stupidtable.min.js"></script>
  47. <script src="http://ctrl.software/semantic/dist/semantic.min.js"></script>
  48.  
  49. </head>
  50. <body>
  51. <br>
  52. <div style="text-align:center;"><img src="http://i.imgur.com/e9RmCeC.png"></div>
  53.  
  54. <br>
  55. <p style="text-align: center;"><span style="font-size:24px;"><a href="http://www.projectpactscripting.com/AIO_Hunter.php">Home</a></span></p>
  56. <br>
  57. <br>
  58. <div class="ui container">
  59. <table class="ui fluid selectable celled sortable green table">
  60. <thead>
  61. <tr>
  62. <th data-sort="int" id="rank">
  63. Rank
  64. <i class="caret down icon" id="rankUp"></i>
  65. <i class="caret up icon" id="rankDown"></i>
  66. </th>
  67. <th data-sort="int" id="user">
  68. Username
  69. <i class="caret down icon" id="userUp"></i>
  70. <i class="caret up icon" id="userDown"></i>
  71. </th>
  72. <th data-sort="int" id="time">
  73. Time Ran
  74. <i class="caret down icon" id="timeUp"></i>
  75. <i class="caret up icon" id="timeDown"></i>
  76. </th>
  77. <th data-sort="int" id="xp">
  78. Exp Gained
  79. <i class="caret down icon" id="xpUp"></i>
  80. <i class="caret up icon" id="xpDown"></i>
  81. </th>
  82. <th data-sort="int" id="npc">
  83. NPCs Caught
  84. <i class="caret down icon" id="npcUp"></i>
  85. <i class="caret up icon" id="npcDown"></i>
  86. </th>
  87. <th data-sort="int" id="profit">
  88. Profit
  89. <i class="caret down icon" id="profitUp"></i>
  90. <i class="caret up icon" id="profitDown"></i>
  91. </th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <?php
  96. if(count($result) > 0) {
  97. $rank = 1;
  98. foreach($result as $r) {
  99. echo '<tr>';
  100. echo '<td data-sort-value"'.$rank.'">'.$rank.'</td>';
  101. echo '<td data-sort-value"'.$r['Username'].'">'.$r['Username'].'</td>';
  102. echo '<td data-sort-value"'.$r['timeran'].'">'.formatTime($r['timeran']).'</td>';
  103. echo '<td data-sort-value"'.$r['expgained'].'">'.number_format($r['expgained']).'</td>';
  104. echo '<td data-sort-value"'.$r['NPC_Caught'].'">'.number_format($r['NPC_Caught']).'</td>';
  105. echo '<td data-sort-value"'.$r['profit'].'">'.number_format($r['profit']).'</td>';
  106. echo '</tr>';
  107.  
  108. $rank++;
  109. }
  110. }
  111. ?>
  112. </tbody>
  113. <tfoot class="full-width">
  114. <tr>
  115. <th></th>
  116. <th colspan="6">
  117.  
  118. </th>
  119. </tr>
  120. </tfoot>
  121. </table>
  122. </body>
  123.  
  124. <br>
  125.  
  126. <div id="footer">
  127. <p style="text-align: center;"><span style="color:#000000;">Made by: ProjectPact &nbsp;| &nbsp;Copyright &copy;. All Rights Reserved.</span></p>
  128. <br>
  129. </div>
  130. <script>
  131. $('#mytable').stupidtable();
  132.  
  133. $('#rank,#user,#time,#xp,#npc,#profit').click(new function(event) {
  134. if($('#'+event.target.id+'Down').is(':visible')) {
  135. $('#'+event.target.id+'Down').hide();
  136. $('#'+event.target.id+'Up').show();
  137. } else {
  138. $('.caret').hide();
  139. $('#'+event.target.id+'Down').show();
  140. }
  141.  
  142.  
  143. });
  144.  
  145. </script>
  146. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement