Advertisement
Guest User

Untitled

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