Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. <xen:title>{xen:raw $pageTitle}</xen:title>
  2.  
  3. <div class="vote-links">
  4. <!-- Vote links here -->
  5. </div>
  6.  
  7. <xen:if is="{$option.enableVoteList}">
  8. <div class="top-voters">
  9. <xen:foreach loop="$voters" value="$user">
  10. <?php
  11. $db_host = 'localhost'; // Server Name
  12. $db_user = 'root'; // Username
  13. $db_pass = ''; // Password
  14. $db_name = 'tutorial'; // Database Name
  15.  
  16. $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
  17. if (!$conn) {
  18. die ('Failed to connect to MySQL: ' . mysqli_connect_error());
  19. }
  20.  
  21. $sql = 'SELECT * FROM votesGALTotals ORDER BY votes,username DESC LIMIT ';
  22.  
  23. $query = mysqli_query($conn, $sql);
  24.  
  25. if (!$query) {
  26. die ('SQL Error: ' . mysqli_error($conn));
  27. }
  28. ?>
  29. <html>
  30. <head>
  31. <title>Voting Page</title>
  32. <style type="text/css">
  33. body {
  34. font-size: 15px;
  35. color: #343d44;
  36. font-family: "segoe-ui", "open-sans", tahoma, arial;
  37. padding: 0;
  38. margin: 0;
  39. }
  40. table {
  41. margin: auto;
  42. font-family: "Lucida Sans Unicode", "Lucida Grande", "Segoe Ui";
  43. font-size: 12px;
  44. }
  45.  
  46. h1 {
  47. margin: 25px auto 0;
  48. text-align: center;
  49. text-transform: uppercase;
  50. font-size: 17px;
  51. }
  52.  
  53. table td {
  54. transition: all .5s;
  55. }
  56.  
  57. /* Table */
  58. .data-table {
  59. border-collapse: collapse;
  60. font-size: 14px;
  61. min-width: 537px;
  62. }
  63.  
  64. .data-table th,
  65. .data-table td {
  66. border: 1px solid #e1edff;
  67. padding: 7px 17px;
  68. }
  69. .data-table caption {
  70. margin: 7px;
  71. }
  72.  
  73. /* Table Header */
  74. .data-table thead th {
  75. background-color: #508abb;
  76. color: #FFFFFF;
  77. border-color: #6ea1cc !important;
  78. text-transform: uppercase;
  79. }
  80.  
  81. /* Table Body */
  82. .data-table tbody td {
  83. color: #353535;
  84. }
  85. .data-table tbody td:first-child,
  86. .data-table tbody td:nth-child(4),
  87. .data-table tbody td:last-child {
  88. text-align: right;
  89. }
  90.  
  91. .data-table tbody tr:nth-child(odd) td {
  92. background-color: #f4fbff;
  93. }
  94. .data-table tbody tr:hover td {
  95. background-color: #ffffa2;
  96. border-color: #ffff0f;
  97. }
  98.  
  99. /* Table Footer */
  100. .data-table tfoot th {
  101. background-color: #e5f5ff;
  102. text-align: right;
  103. }
  104. .data-table tfoot th:first-child {
  105. text-align: left;
  106. }
  107. .data-table tbody td:empty
  108. {
  109. background-color: #ffcccc;
  110. }
  111. </style>
  112. </head>
  113. <body>
  114. <h1>Top Voters</h1>
  115. <table class="data-table">
  116. <caption class="title">Top Voters</caption>
  117. <thead>
  118. <tr>
  119. <th>Username</th>
  120. <th>Votes</th>
  121. </tr>
  122. </thead>
  123. <tbody>
  124. <?php
  125. $no = 1;
  126. $total = 0;
  127. while ($row = mysqli_fetch_array($query))
  128. {
  129. $amount = $row['amount'] == 0 ? '' : number_format($row['amount']);
  130. echo '<tr>
  131. <td>'.$no.'</td>
  132. <td>'.$row['name'].'</td>
  133. <td>'.$row['Votes'].'</td>
  134. }?>
  135. </tbody>
  136. <tfoot>
  137. <tr>
  138. <th colspan="4">TOTAL</th>
  139. <th><?=number_format($total)?></th>
  140. </tr>
  141. </tfoot>
  142. </table>
  143. </body>
  144. </html>
  145. </xen:foreach>
  146. </div>
  147. </xen:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement