Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. <?php
  2. require 'CreateTables.php';
  3. require 'db_connection.php';
  4.  
  5. $tableName = 'providerInfo';
  6. $getProvider = "SELECT * FROM $tableName";
  7. $statement = $conn->prepare($getProvider);
  8. $statement->execute();
  9. $results = $statement->fetchAll(PDO::FETCH_ASSOC);
  10. $number_of_rows = $statement->rowCount();
  11.  
  12. $tableName = 'setting';
  13. $getProvider = "SELECT * FROM $tableName ORDER BY reg_date DESC";
  14. $statement = $conn->prepare($getProvider);
  15. $statement->execute();
  16. $refresh = $statement->fetch(PDO::FETCH_ASSOC);//print_r($refresh);
  17.  
  18.  
  19. ?>
  20. <!DOCTYPE html>
  21. <html lang="en">
  22. <head>
  23. <?php include('includes/head.php'); ?>
  24. </head>
  25. <body>
  26. <?php include('includes/navbar.php') ?>
  27.  
  28. <div class="container-fluid" style="background: #ffffff">
  29.  
  30. <div class="panel panel-primary">
  31. <div class="panel-heading">
  32. Status
  33. </div>
  34. <div class="panel-body">
  35.  
  36.  
  37. <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
  38. <thead>
  39. <th>#</th>
  40. <th>0</th>
  41. <th>Status</th>
  42. <th>Supplier</th>
  43. <th>Host & Port</th>
  44. <th>Username</th>
  45. <th>Password</th>
  46. <th>Expire date</th>
  47. <th>Connections</th>
  48. <th>Notes</th>
  49. <th>Downloads</th>
  50. </thead>
  51. <tbody>
  52. <?php
  53. $i = 1;
  54. foreach ($results as $provider) {
  55.  
  56. /*$host_name = "http://ss1.slykdns.com:5005";
  57. $username = "freelancer";
  58. $password = "password";*/
  59. $host_name = $provider['host_port'];
  60. $username = $provider['username'];
  61. $password = $provider['password'];
  62.  
  63. $result = getValue($host_name, $username, $password);
  64.  
  65. if ($result->auth == 0) {
  66.  
  67. echo '<div class="alert alert-warning">
  68. Authenticate Failed for this user:' . $username . '
  69. </div>';
  70. continue;
  71. }
  72.  
  73. ?>
  74. <tr>
  75. <td><?php echo $i++; ?></td>
  76. <td><?php
  77. if ($result->status == "Active") {
  78. echo '<strong> <p class="text-success">ON</p></strong>';
  79.  
  80. } else {
  81. echo '<strong> <p class="text-danger">OFF</p></strong>';
  82. }
  83. ?>
  84. </td>
  85. <td><?php
  86. if ($result->status == "Active") {
  87. echo '<strong> <p class="text-success">Enabled</p></strong>';
  88.  
  89. } else {
  90. echo '<strong> <p class="text-danger">Disable</p></strong>';
  91. }
  92.  
  93.  
  94. ?></td>
  95. <td><?php echo $provider['provider_name']; ?></td>
  96. <td><?php echo $provider['host_port'] ?></td>
  97. <td><?php echo $result->username; ?></td>
  98. <td><?php echo $result->password; ?></td>
  99.  
  100. <td><?php echo(date("d/m/Y h:i:s A T", $result->exp_date)); ?></td>
  101. <td><?php echo $result->active_cons . "/ ";
  102. echo $result->max_connections; ?></td>
  103. <td><?php $provider['notes'] ?></td>
  104.  
  105. <td>
  106. <a class="btn btn-success"
  107. href="<?php echo $host_name . '/get.php?username=' . $username . '&password=' . $password . '&type=m3u&output=ts'; ?>">Download</a>
  108. <a class="btn btn-info"
  109. href="<?php echo $host_name . '/get.php?username=' . $username . '&password=' . $password . '&type=m3u&output=m3u8'; ?>">Download</a>
  110.  
  111.  
  112. </td>
  113.  
  114. </tr>
  115.  
  116. <?php
  117. }
  118.  
  119. ?>
  120. </tbody>
  121. </table>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="footer">
  126. <div class="container">
  127. Copyright
  128. </div>
  129. </div>
  130. </body>
  131. <script>
  132. $(document).ready(function () {
  133. $('#example').DataTable();
  134. });
  135. </script>
  136. </html>
  137.  
  138. <?php
  139.  
  140.  
  141. function getValue($host_name, $username, $password)
  142. {
  143.  
  144. $url = $host_name . "/" . "player_api.php?username=" . $username . "&password=" . $password;
  145.  
  146. //$url = 'test.json'; // path to your JSON file
  147. $data = file_get_contents($url); // put the contents of the file into a variable
  148. $characters = json_decode($data); // decode the JSON feed
  149.  
  150. foreach ($characters as $character) {
  151. //print_r($character);
  152.  
  153. //echo $character->auth;
  154. return $character;
  155. break;
  156. }
  157. return 0;
  158.  
  159. }
  160.  
  161. $value = $refresh['page_refresh_time'];//echo $value;
  162.  
  163. ?>
  164. <script>
  165. setTimeout(function () {
  166. window.location.reload(1);
  167. }, <?php echo $value;?>);
  168. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement