Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Code By : Mahiruddin a.k.a Mhrdpy.NET
  5. * Date Edit : 16 - 12 - 2018
  6. * Dont Edit Anything If You Don't Know About Script
  7. * SMM Panel Script - Mhrdpy.NET
  8. * Demo => https://scriptsmm.web.id/ ( User & Pass : admin )
  9. * Contact Person :
  10. => Whatsapp : 0895 3378 26740
  11. => Facebook : Mahir Depay (https://facebook.com/hirpayzzz)
  12. => Instagram : mahirdpy_ (https://instagram.com/mahirdpy_)
  13. => Email : mahirdpy@gmail.com
  14. __ __ _ _ _ _ ______ _______
  15. | \/ | | | | | \ | | ____|__ __|
  16. | \ / | |__ _ __ __| |_ __ _ _ | \| | |__ | |
  17. | |\/| | '_ \| '__/ _` | '_ \| | | | | . ` | __| | |
  18. | | | | | | | | | (_| | |_) | |_| |_| |\ | |____ | |
  19. |_| |_|_| |_|_| \__,_| .__/ \__, (_)_| \_|______| |_|
  20. | | __/ |
  21. |_| |___/
  22. **/
  23.  
  24. session_start();
  25. require("../mainconfig.php");
  26. $page_type = "Top 5 Pengguna";
  27.  
  28. if (isset($_SESSION['user'])) {
  29. $sess_username = $_SESSION['user']['username'];
  30. $check_user = $db->query("SELECT * FROM users WHERE username = '$sess_username'");
  31. $data_user = $check_user->fetch_array(MYSQLI_ASSOC);
  32. if ($check_user->num_rows == 0) {
  33. header("Location: ".$site_config['base_url']."user/logout");
  34. } else if ($data_user['status'] == "Suspended") {
  35. header("Location: ".$site_config['base_url']."user/logout");
  36. }
  37.  
  38. include("../lib/header.php");
  39. ?>
  40.  
  41. <div class="row">
  42. <div class="col-md-12">
  43. <div class="card-box">
  44. <h4 class="m-t-0 text-uppercase text-center header-title"><i class="mdi mdi-trophy"></i> Top 5 Pesanan Medsos</h4><hr>
  45. <div class="table-responsive">
  46. <table class="table table-bordered table-striped table-hover">
  47. <thead>
  48. <tr>
  49. <th>No</th>
  50. <th>Nama</th>
  51. <th>Total Pembelian</th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. <?php
  56. date(dmy);
  57. $no = 1;
  58. $datak = $db->query("SELECT a.username as users, b.user , SUM(b.price) as total FROM users a INNER JOIN orders b ON a.username = b.user where user = a.username GROUP BY b.user ORDER BY total DESC LIMIT 5");
  59. while($use = mysqli_fetch_array($datak)){
  60. if ($no == "1") {
  61. $label = "success";
  62. } else if ($no == "2") {
  63. $label = "info";
  64. } else if ($no == "3") {
  65. $label = "warning";
  66. }
  67. ?>
  68. <tr class="table-<?php echo $label; ?>">
  69. <th scope="row"><?php echo $no; ?></th>
  70. <td><?php echo $use['users']; ?></td>
  71. <td>Rp <?php echo number_format($use['total'],0,",",".");?></td>
  72. </tr>
  73. <?php $no++; } ?>
  74. </tbody>
  75. </table>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80.  
  81. <?php
  82. include("../lib/footer.php");
  83. } else {
  84. header("Location: ".$site_config['base_url']);
  85. }
  86. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement