Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require("mainconfig.php");
- $msg_type = "nothing";
- if (isset($_SESSION['user'])) {
- $sess_username = $_SESSION['user']['username'];
- $check_user = mysqli_query($db, "SELECT * FROM users WHERE username = '$sess_username'");
- $data_user = mysqli_fetch_assoc($check_user);
- if (mysqli_num_rows($check_user) == 0) {
- header("Location: ".$cfg_baseurl."logout.php");
- } else if ($data_user['status'] == "Suspended") {
- header("Location: ".$cfg_baseurl."logout.php");
- }
- $check_order = mysqli_query($db, "SELECT SUM(price) AS total FROM orders WHERE user = '$sess_username'");
- $data_order = mysqli_fetch_assoc($check_order);
- $count_users = mysqli_num_rows(mysqli_query($db, "SELECT * FROM users"));
- $total_pending = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE status = 'Pending' AND user = '$sess_username'"));
- $total_proses = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE status = 'Processing' AND user = '$sess_username'"));
- $total_partial = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE status = 'Partial' AND user = '$sess_username'"));
- $total_sukses = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE status = 'Success' AND user = '$sess_username'"));
- $total_error = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE status = 'Error' AND user = '$sess_username'"));
- $count_orders = mysqli_num_rows(mysqli_query($db, "SELECT * FROM orders WHERE user = '$sess_username'"));
- } else {
- if (isset($_POST['login'])) {
- $post_username = mysqli_real_escape_string($db, trim($_POST['username']));
- $post_password = mysqli_real_escape_string($db, trim($_POST['password']));
- if (empty($post_username) || empty($post_password)) {
- $msg_type = "error";
- $msg_content = "<b>Gagal:</b> Mohon mengisi semua input.";
- } else {
- $check_user = mysqli_query($db, "SELECT * FROM users WHERE username = '$post_username'");
- if (mysqli_num_rows($check_user) == 0) {
- $msg_type = "error";
- $msg_content = '<b>Gagal:</b> Username atau password salah.<script>swal("Error!", "Username atau password salah.", "error");</script>';
- } else {
- $data_user = mysqli_fetch_assoc($check_user);
- if ($post_password <> $data_user['password']) {
- $msg_type = "error";
- $msg_content = '<b>Gagal:</b> Username atau password salah.<script>swal("Error!", "Username atau password salah.", "error");</script>';
- } else if ($data_user['status'] == "Suspended") {
- $msg_type = "error";
- $msg_content = '<b>Gagal:</b> Akun Tidak Aktif.<script>swal("Error!", "Akun Suspended.", "error");</script>';
- } else if ($_POST['captcha'] !== "Manusia") {
- $msg_type = "error";
- $msg_content = '<script>swal("Error!", "Anda bukan manusia.", "error");</script>';
- } else {
- $_SESSION['user'] = $data_user;
- header("Location: ".$cfg_baseurl);
- }
- }
- }
- }
- }
- include("lib/header.php");
- if (isset($_SESSION['user'])) {
- ?>
- <div class="content-page">
- <div class="content">
- <div class="container">
- <div class="row">
- <div class="col-xs-12">
- <div class="page-title-box">
- <h4 class="page-title">Halaman Utama</h4>
- <ol class="breadcrumb p-0 m-0">
- <li>
- <a href="#"><?php echo $cfg_webname; ?></a>
- </li>
- <li class="active">
- Halaman Utama
- </li>
- </ol>
- <div class="clearfix"></div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-8">
- <div class="panel panel-color panel-info">
- <div class="panel-heading">
- <h3 class="panel-title"><i class="fa fa-line-chart"></i> Grafik Transaksi </h3>
- </div>
- <div class="panel-body">
- <canvas id="myChart"></canvas>
- <script>
- var ctx = document.getElementById("myChart");
- var myChart = new Chart(ctx, {
- type: 'line',
- data: {
- labels: ["Pending", "Error", "Sukses", "Processing", "Partial"],
- datasets: [{
- label: "Jumlah Transksi",
- fill: false,
- lineTension: 0.1,
- backgroundColor: "#10c469",
- borderColor: "#10c469",
- borderCapStyle: 'butt',
- borderDash: [],
- borderDashOffset: 0.0,
- borderJoinStyle: 'miter',
- pointBorderColor: "#10c469",
- pointBackgroundColor: "#fff",
- pointBorderWidth: 1,
- pointHoverRadius: 5,
- pointHoverBackgroundColor: "#10c469",
- pointHoverBorderColor: "#eef0f2",
- pointHoverBorderWidth: 2,
- pointRadius: 1,
- pointHitRadius: 10,
- data: [<?php echo $total_pending; ?>, <?php echo $total_error; ?>, <?php echo $total_sukses; ?>, <?php echo $total_proses; ?>, <?php echo $total_partial; ?>],
- }]
- },
- options: {
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: true
- }
- }]
- }
- }
- });
- </script>
- </div>
- </div>
- </div>
- <div class="col-lg-4 col-md-4">
- <div class="card-box widget-box-three">
- <div class="bg-icon pull-left">
- <i class="ti-shopping-cart"></i>
- </div>
- <div class="text-right">
- <p class="text-success m-t-5 text-uppercase font-600 font-secondary">Total Pembelian</p>
- <h2 class="m-b-10"><span data-plugin="">Rp <?php echo number_format($data_order['total'],0,',','.'); ?></span></h2>
- </div>
- </div>
- <div class="card-box widget-box-three">
- <div class="bg-icon pull-left">
- <i class="ti-money"></i>
- </div>
- <div class="text-right">
- <p class="text-pink m-t-5 text-uppercase font-600 font-secondary">Sisa Saldo</p>
- <h2 class="m-b-10"><span data-plugin="">Rp <?php echo number_format($data_user['balance'],0,',','.'); ?></span></h2>
- </div>
- </div>
- <div class="card-box widget-box-three">
- <div class="bg-icon pull-left">
- <i class="mdi mdi-cart"></i>
- </div>
- <div class="text-right">
- <p class="text-pink m-t-5 text-uppercase font-600 font-secondary">Total Transaksi</p>
- <h2 class="m-b-10"><span data-plugin=""><?php echo $count_orders; ?> Transaksi</span></h2>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <div class="panel panel-color panel-info">
- <div class="panel-heading">
- <h3 class="panel-title"><i class="mdi mdi-information-variant"></i> Berita & Informasi</h3>
- </div>
- <div class="panel-body">
- <div class="table-responsive">
- <table class="table table-striped table-bordered table-hover m-0">
- <thead>
- <tr>
- <th>#</th>
- <th>Tanggal</th>
- <th>Isi</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $check_news = mysqli_query($db, "SELECT * FROM news ORDER BY id DESC LIMIT 5");
- $no = 1;
- while ($data_news = mysqli_fetch_assoc($check_news)) {
- ?>
- <tr>
- <th scope="row"><?php echo $no; ?></th>
- <td><?php echo $data_news['date']; ?></td>
- <td><?php echo $data_news['content']; ?></td>
- </tr>
- <?php
- $no++;
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- end row -->
- <?php
- } else {
- ?>
- <div class="content-page">
- <div class="content">
- <div class="container">
- <div class="row">
- <div class="col-xs-12">
- <div class="page-title-box">
- <h4 class="page-title">Masuk</h4>
- <ol class="breadcrumb p-0 m-0">
- <li>
- <a href="#"><?php echo $cfg_webname; ?></a>
- </li>
- <li class="active">
- Masuk
- </li>
- </ol>
- <div class="clearfix"></div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-7">
- <div class="panel panel-color panel-info">
- <div class="panel-heading">
- <h3 class="panel-title"><i class="mdi mdi-import"></i> Masuk</h3>
- </div>
- <div class="panel-body">
- <?php
- if ($msg_type == "error") {
- ?>
- <div class="alert alert-danger">
- <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
- <i class="fa fa-times-circle"></i>
- <?php echo $msg_content; ?>
- </div>
- <?php
- }
- ?>
- <form class="form-horizontal" role="form" method="POST">
- <div class="form-group">
- <label class="col-md-2 control-label">Username</label>
- <div class="col-md-10">
- <input type="text" name="username" class="form-control" placeholder="Username">
- </div>
- </div>
- <div class="form-group">
- <label class="col-md-2 control-label">Password</label>
- <div class="col-md-10">
- <input type="password" name="password" class="form-control" placeholder="Password">
- </div>
- </div>
- <div class="form-group">
- <label class="col-md-2 control-label">Captcha</label>
- <div class="col-md-10">
- <select class="form-control" id="captcha" name="captcha">
- <option selected="true" style="display:none;">Apakah Anda Manusia?</option>
- <option value="Manusia">Saya Manusia</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <button type="submit" name="login" class="btn btn-info waves-effect waves-light"> Masuk</button>
- <button type="reset" class="btn btn-default waves-effect waves-light"> Ulangi</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <div class="col-md-5">
- <div class="panel panel-color panel-info">
- <div class="panel-heading">
- <h3 class="panel-title"><i class="mdi mdi-information-outline"></i> Tentang Kami</h3>
- </div>
- <div class="panel-body">
- <p><?php echo $cfg_desc; ?></p>
- <ul>
- <li>Instant & Auto processing.</li>
- <li>Cheapest price.</li>
- <li>Layanan lengkap.</li>
- <li>24 Hours support.</li>
- <li>Deposit via Bank & Pulsa.</li>
- </ul><hr>
- <center><a href="//www.dmca.com/Protection/Status.aspx?ID=0e3f1e93-5f14-4ec9-a0c9-ea1f67e1ced2" title="DMCA.com Protection Status" class="dmca-badge" target="_top"> <img src="//images.dmca.com/Badges/dmca-badge-w200-5x1-06.png?ID=0e3f1e93-5f14-4ec9-a0c9-ea1f67e1ced2" alt="DMCA.com Protection Status"></a> <script src="//images.dmca.com/Badges/DMCABadgeHelper.min.js"> </script></center>
- </div>
- </div>
- </div>
- </div>
- <?php
- }
- include("lib/footer.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement