Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- session_start();
- if(isset($_SESSION['username'])) {
- echo '<meta http-equiv="Refresh" Content="0; URL=error">';
- exit;
- }
- ?>
- <!doctype html>
- <html class="no-js" lang="en" dir="ltr">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Selamat datang di portal VPN</title>
- <link rel="stylesheet" href="css/foundation.css">
- <link rel="stylesheet" href="css/app.css">
- </head>
- <body class="background-login">
- <div class="grid-container">
- <div class="grid-x grid-padding-x grid-padding-y">
- <div class="large-12 text-center cell">
- <h3>Selamat datang di portal VPN</h3>
- </div>
- </div>
- <div class="grid-x grid-padding-x">
- <div class="large-12 cell">
- <div class="login-box">
- <div class="row collapse expanded">
- <form class="log-in-form" action="" method="post">
- <div class="small-12 medium-6 column small-order-2 medium-order-1">
- <div class="login-box-form-section">
- <div class="text-center">
- <img src="https://img.icons8.com/bubbles/50/000000/enter-2.png">
- </div>
- <input class="login-box-input" type="text" name="username" placeholder="Username" />
- <input class="login-box-input" type="password" name="password2" placeholder="Password" />
- <input class="login-box-submit-button" type="submit" name="login" value="Masuk" />
- </div>
- </div>
- <div class="small-12 medium-6 column small-order-1 medium-order-2 login-box-social-section">
- <div class="login-box-social-section-inner">
- <span class="login-box-social-headline">Tempat untuk mengelola VPN di manapun anda berada
- <?php
- session_start();
- require_once("connection/connection.php");
- if ($_POST['login']) {
- $username = $_POST['username'];
- $password2 = $_POST['password2'];
- $sql = "SELECT * FROM vpn_pengguna WHERE username = '$username'";
- $query = $db->query($sql);
- $hasil = $query->fetch(PDO::FETCH_ASSOC);
- if($username <> $hasil['username']) {
- echo "<div class='text-center'><h5>Nama pengguna belum terdaftar!</h5></div>";
- } else {
- if($password <> $hasil['password2']) {
- echo "<div class='text-center'><h5>Kata sandi salah!</h5></div>";
- } else {
- $_SESSION['user_id'] = $hasil['user_id'];
- $_SESSION['username'] = $hasil['username'];
- list($password2, $enc_iv) = explode("::", $password2);
- $cipher_method = 'aes-128-ctr';
- $enc_key = openssl_digest(php_uname(), 'SHA256', TRUE);
- $password = openssl_decrypt($password2, $cipher_method, $enc_key, 0, hex2bin($enc_iv));
- $_SESSION['password'] = $hasil['password'];
- $_SESSION['group_name'] = $hasil['group_name'];
- if($_SESSION['group_name'] == 'Administrator')
- echo '<div class="text-center"><h5>Mengarahkan ke halaman Admin</h5> <meta http-equiv="Refresh" Content="1; URL=admin"></div>';
- exit;
- }
- }
- }
- ?>
- </span>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="js/vendor/jquery.js"></script>
- <script src="js/vendor/what-input.js"></script>
- <script src="js/vendor/foundation.js"></script>
- <script src="js/app.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement