Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require'../lib/config.php';
- @$users = $_SESSION['login'];
- $mysqli->query("SELECT username FROM users WHERE username = '$users'");
- $validation = $mysqli->numRows();
- if($validation > 0 && $users && !($_GET['page'])) {
- Redirect($setting->url."/dashboard");
- }
- if($_GET['page'] == 'Login' || $_GET['page'] == '') {?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="<?php echo $setting->charset;?>">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="<?php echo $setting->description;?>/">
- <meta name="author" content="M-Supian.ID">
- <meta name="keyword" content="<?php echo $setting->keywords;?>/">
- <link rel="shortcut icon" href="<?php echo $setting->img;?>/favicon.png">
- <title><?php echo $setting->title;?> | Signin</title>
- <!-- Bootstrap core CSS -->
- <link href="<?php echo $setting->css;?>/bootstrap.min.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/bootstrap-reset.css" rel="stylesheet">
- <!--external css-->
- <link href="<?php echo $setting->assets;?>/font-awesome/css/font-awesome.css" rel="stylesheet" />
- <!-- Custom styles for this template -->
- <link href="<?php echo $setting->css;?>/style.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/style-responsive.css" rel="stylesheet" />
- <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
- <!--[if lt IE 9]>
- <script src="<?php echo $setting->js;?>/html5shiv.js"></script>
- <script src="<?php echo $setting->js;?>/respond.min.js"></script>
- <![endif]-->
- </head>
- <body class="login-body">
- <div class="container">
- <form class="form-signin" method="POST">
- <h2 class="form-signin-heading">sign in now</h2>
- <div class="login-wrap">
- <?php Message();?>
- <input type="text" class="form-control" name="username" placeholder="Username" autofocus>
- <input type="password" class="form-control" name="password" placeholder="Password">
- <label class="checkbox">
- <input type="checkbox" name="rememberme"> Remember me
- <span class="pull-right">
- <a href="<?php echo $setting->url."/forgot";?>"> Forgot Password?</a>
- </span>
- </label>
- <button class="btn btn-lg btn-login btn-block" type="submit" name="signin">Sign in</button>
- <div class="registration">
- Don't have an account yet?
- <a class="" href="signup">
- Create an account
- </a>
- </div>
- </div>
- </form>
- </div>
- <!-- js placed at the end of the document so the pages load faster -->
- <script src="<?php echo $setting->js;?>/jquery.js"></script>
- <script src="<?php echo $setting->js;?>/bootstrap.min.js"></script>
- </body>
- </html>
- <?php } /*
- |--------------------------------------------------------------------------
- | GET login
- |--------------------------------------------------------------------------
- */
- else if ($_GET['page'] == 'Register') {?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="<?php echo $setting->charset;?>">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="<?php echo $setting->description;?>/">
- <meta name="author" content="M-Supian.ID">
- <meta name="keyword" content="<?php echo $setting->keywords;?>/">
- <link rel="shortcut icon" href="<?php echo $setting->img;?>/favicon.png">
- <title><?php echo $setting->title;?> | Signup</title>
- <!-- Bootstrap core CSS -->
- <link href="<?php echo $setting->css;?>/bootstrap.min.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/bootstrap-reset.css" rel="stylesheet">
- <!--external css-->
- <link href="<?php echo $setting->assets;?>/font-awesome/css/font-awesome.css" rel="stylesheet" />
- <!-- Custom styles for this template -->
- <link href="<?php echo $setting->css;?>/style.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/style-responsive.css" rel="stylesheet" />
- <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
- <!--[if lt IE 9]>
- <script src="js/html5shiv.js"></script>
- <script src="js/respond.min.js"></script>
- <![endif]-->
- </head>
- <body class="login-body">
- <div class="container">
- <form class="form-signin" method="POST">
- <h2 class="form-signin-heading">registration now</h2>
- <div class="login-wrap">
- <p> Enter your account details below</p>
- <?php Message();?>
- <input type="text" class="form-control" name="username" placeholder="User Name" autofocus required>
- <input type="text" class="form-control" name="email" placeholder="Email" autofocus>
- <input type="password" class="form-control" name="password" placeholder="Password" require>
- <input type="password" class="form-control" name="retype" placeholder="Re-type Password" require>
- <button class="btn btn-lg btn-login btn-block" type="submit" name="signup">Submit</button>
- <div class="registration">
- Already Registered.
- <a class="" href="signin">
- Login
- </a>
- </div>
- </div>
- </form>
- </div>
- <!-- js placed at the end of the document so the pages load faster -->
- <script src="<?php echo $setting->js;?>/jquery.js"></script>
- <script src="<?php echo $setting->js;?>/bootstrap.min.js"></script>
- </body>
- </html>
- <?php }
- else if($_GET['page'] == "Lock") {
- $_SESSION['unlock'] = "False";
- if(!$users) {
- Redirect($setting->url."/signin");
- }?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="<?php echo $setting->charset;?>">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="<?php echo $setting->description;?>/">
- <meta name="author" content="M-Supian.ID">
- <meta name="keyword" content="<?php echo $setting->keywords;?>/">
- <link rel="shortcut icon" href="<?php echo $setting->img;?>/favicon.png">
- <title><?php echo $setting->title;?> | Lock Screen</title>
- <!-- Bootstrap core CSS -->
- <link href="<?php echo $setting->css;?>/bootstrap.min.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/bootstrap-reset.css" rel="stylesheet">
- <!--external css-->
- <link href="<?php echo $setting->assets;?>/font-awesome/css/font-awesome.css" rel="stylesheet" />
- <!-- Custom styles for this template -->
- <link href="<?php echo $setting->css;?>/style.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/style-responsive.css" rel="stylesheet" />
- <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
- <!--[if lt IE 9]>
- <script src="<?php echo $setting->js;?>/html5shiv.js"></script>
- <script src="<?php echo $setting->js;?>/respond.min.js"></script>
- <![endif]-->
- </head>
- <body class="lock-screen" onload="startTime()">
- <div class="lock-wrapper">
- <div id="time"></div>
- <div class="lock-box text-center">
- <img src="<?php echo $setting->img;?>/follower-avatar.jpg" alt="lock avatar"/>
- <h1><?php echo $_SESSION['login'];?></h1>
- <span class="locked">Locked</span>
- <?php Message();?>
- <form role="form" class="form-inline" method="POST" action="">
- <div class="form-group col-lg-12">
- <input type="password" placeholder="Password" class="form-control" name="password" required>
- <button class="btn btn-lock" type="submit" name="unlock">
- Unlock <i class="fa fa-unlock"></i>
- </button>
- </div>
- </form>
- </div>
- </div>
- <!-- js placed at the end of the document so the pages load faster -->
- <script src="<?php echo $setting->js;?>/jquery.js"></script>
- <script src="<?php echo $setting->js;?>/bootstrap.min.js"></script>
- <script>
- function startTime() {
- var today=new Date();
- var h=today.getHours();
- var m=today.getMinutes();
- var s=today.getSeconds();
- // add a zero in front of numbers<10
- m=checkTime(m);
- s=checkTime(s);
- document.getElementById('time').innerHTML=h+":"+m+":"+s;
- t=setTimeout(function(){startTime()},500);
- }
- function checkTime(i) {
- if (i<10){
- i="0" + i;
- }
- return i;
- }
- </script>
- </body>
- </html>
- <?php } else if($_GET['page'] == "Forgot") { ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="<?php echo $setting->charset;?>">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="<?php echo $setting->description;?>/">
- <meta name="author" content="M-Supian.ID">
- <meta name="keyword" content="<?php echo $setting->keywords;?>/">
- <link rel="shortcut icon" href="<?php echo $setting->img;?>/favicon.png">
- <title><?php echo $setting->title;?> | Signin</title>
- <!-- Bootstrap core CSS -->
- <link href="<?php echo $setting->css;?>/bootstrap.min.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/bootstrap-reset.css" rel="stylesheet">
- <!--external css-->
- <link href="<?php echo $setting->assets;?>/font-awesome/css/font-awesome.css" rel="stylesheet" />
- <!-- Custom styles for this template -->
- <link href="<?php echo $setting->css;?>/style.css" rel="stylesheet">
- <link href="<?php echo $setting->css;?>/style-responsive.css" rel="stylesheet" />
- <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
- <!--[if lt IE 9]>
- <script src="<?php echo $setting->js;?>/html5shiv.js"></script>
- <script src="<?php echo $setting->js;?>/respond.min.js"></script>
- <![endif]-->
- </head>
- <body class="login-body">
- <div class="container">
- <form class="form-signin" method="POST">
- <h2 class="form-signin-heading">Forgot Password</h2>
- <div class="login-wrap">
- <input type="text" class="form-control" name="username" placeholder="Username" autofocus>
- <button class="btn btn-lg btn-login btn-block" type="submit" name="forgot">Forgot</button>
- <div class="registration">
- Don't have an account yet?
- <a class="" href="signup">
- Create an account
- </a>
- </div>
- </div>
- </form>
- </div>
- <!-- js placed at the end of the document so the pages load faster -->
- <script src="<?php echo $setting->js;?>/jquery.js"></script>
- <script src="<?php echo $setting->js;?>/bootstrap.min.js"></script>
- </body>
- </html>
- <?php }
- /*
- |--------------------------------------------------------------------------
- | Jangan dirubah bila anda tidak mengerti PHP
- |--------------------------------------------------------------------------
- */
- @$username = Clear($_POST['username']);
- @$email = Clear($_POST['email']);
- @$passwd = $_POST['password'];
- @$retype = $_POST['retype'];
- // Encryption Password
- @$password = Encrypt($username, $passwd); // result ex: Susan_98e15403b2b1ea5 // Bisa didecrypt ? ntahlah :v
- /*
- |--------------------------------------------------------------------------
- | Proses pendaftaran
- |--------------------------------------------------------------------------
- */
- if(isset($_POST['signup'])) {
- if(!strstr($email, "@")) {
- AddMessage_W("Invalid email, please input correctly");
- Redirect();
- exit();
- }
- foreach(array(" ", "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "=", "+", "{", "}", "[", "]", "\\", "|", ";", ":", "<", ">", ",", ".", "?", "/") as $value) {
- if(strstr($_POST['username'], $value)) {
- AddMessage_W("Username should not contain symbol");
- Redirect();
- exit();
- }
- }
- if(strlen($_POST['password']) < 5) {
- AddMessage_W("Password length must be at least five letters or more");
- Redirect();
- exit();
- }
- // Validasi User & email
- $mysqli->query("SELECT username FROM users WHERE username = '$username'");
- $rowUser = $mysqli->numRows();
- $mysqli->query("SELECT email FROM users WHERE email = '$email'");
- $rowEmail = $mysqli->numRows();
- if($rowUser > 0) {
- AddMessage_E("Username already used");
- } else if ($rowEmail > 0 ) {
- AddMessage_E("Email already registered");
- } else if ($passwd != $retype) {
- AddMessage_E("Password must match");
- } else {
- // Validasi Referal Code
- $referal = $_SESSION['referal'];
- $mysqli->query("SELECT username FROM users WHERE referral_code = '$referal'");
- $row = $mysqli->fetchArray();
- $validation = $mysqli->numRows();
- if($validation == 1) {
- $referer = $row['username'];
- }
- // Make Referal Code
- $referral_code = Random(20);
- // Insert New Account to DB
- // Insert Credit
- if($referer) {
- $queryUser = $mysqli->query("INSERT INTO users (id, username, password, email, referral_code, referer, credit) VALUES (NULL, '$username', '$password', '$email', '$referral_code', '$referer', '75') ");
- $queryBonusCredit = $mysqli->query("UPDATE users SET credit = credit + 10 WHERE username = '$referer'");
- } else {
- $queryUser = $mysqli->query("INSERT INTO users (id, username, password, email, referral_code, referer, credit) VALUES (NULL, '$username', '$password', '$email', '$referral_code', '-', '50') ");
- }
- // Finish
- if(($queryUser && $queryBonusCredit) || $queryUser) {
- session_unset($_SESSION['referal']);
- AddMessage_S("Success create new account");
- Redirect($setting->url."/signin");
- exit();
- } else {
- AddMessage_S("Please contact admin");
- }
- }
- Redirect();
- }
- /*
- |--------------------------------------------------------------------------
- | Proses Login
- |--------------------------------------------------------------------------
- */
- if(isset($_POST['signin'])) {
- // Cek validasi user
- $mysqli->query("SELECT username, email, password, status FROM users WHERE username = '$username' OR email = '$email'");
- $validation = $mysqli->numRows();
- $fetchArray = $mysqli->fetchArray();
- if($validation != 1) {
- AddMessage_E("Account is not registered");
- } else if($fetchArray['status'] == "Banned") {
- AddMessage_E("Your account has suspended, please contact admin");
- } else if($fetchArray['password'] != "$password") {
- AddMessage_E("Wrong password");
- } else {
- if (isset($_POST['rememberme'])) {
- setcookie("username", $username, time() + 60 * 60 * 24 * 100, '/');
- }
- session_start();
- $_SESSION['login'] = $fetchArray['username'];
- $_SESSION['unlock'] = "True";
- Redirect($setting->url);
- exit();
- }
- Redirect();
- }
- /*
- --------------------------------------------------------------------------
- | Proses Unlock
- |--------------------------------------------------------------------------
- */
- if(isset($_POST['unlock'])) {
- $username = $_SESSION['login'];
- // Encryption Password
- $password = Encrypt($username, $passwd); // result ex: Susan_98e15403b2b1ea5 // Bisa didecrypt ? ntahlah :v
- // Cek validasi user
- $mysqli->query("SELECT username, password FROM users WHERE username = '$username'");
- $fetchArray = $mysqli->fetchArray();
- if ($fetchArray['password'] != "$password") {
- AddMessage_E("Wrong password");
- } else {
- session_start();
- $_SESSION['login'] = $fetchArray['username'];
- $_SESSION['unlock'] = "True";
- Redirect("dashboard");
- exit;
- }
- Redirect();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement