Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("config.php");
- session_start();
- if(isset($_SESSION["user"]) && !empty($_SESSION["user"])){
- exit(header("Location: /panel/index.php"));
- }
- if(isset($_POST["submit"])){
- if(!isset($_POST["user"]) || empty($_POST["user"])){
- $_SESSION["errorx"] = "You Need To Insert Your Username And Password!";
- exit(header("Location: /panel/login.php"));
- }else if(!isset($_POST["pass"]) || empty($_POST["pass"])){
- $_SESSION["errorx"] = "You Need To Insert Your Username And Password!";
- exit(header("Location: /panel/login.php"));
- }else{
- $servername = "localhost";
- $username = "root";
- $password = "oGM0zotOMn098GimSfGCnWhHS8Nyr94chQHJaGg2B55LpgAfu-";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=booter", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- $user = $con->real_escape_string(htmlspecialchars(stripslashes(strip_tags($_POST["user"]))));
- $pass = md5($con->real_escape_string(htmlspecialchars(stripslashes(strip_tags($_POST["pass"])))));
- $sql = "SELECT id, firstname, lastname FROM MyGuests";
- $result = $conn->query($sql);
- if($res->num_rows === 1){
- $data = $res->fetch_assoc();
- $act = $data["active"];
- $id = $data["id"];
- if(intval($act) === 0){
- $_SESSION["errorx"] = "This account has been disabled";
- exit(header("Location: /panel/login.php"));
- }
- $_SESSION["errorx"] = 0;
- $_SESSION["userx"] = $user;
- $ipx = strval(getremoteip());
- $uuid = sha1(time() + mt_rand(200, 99999))."X".md5(mt_rand(100,999)."".mt_rand(100,999));
- $_SESSION["uuid"] = strval($uuid);
- $sql = "UPDATE users SET lastip='$ipx',uuid='$uuid' WHERE id='$id'";
- $conn->query($sql);
- $conn->close();
- exit(header("Location: /panel/login.php"));
- }else{
- $_SESSION["errorx"] = "Invalid Username Or Password!";
- exit(header("Location: /panel/login.php"));
- }
- $con->close();
- }
- exit(header("Location: login.php"));
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>MCSpam - Login</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <link rel="stylesheet" type="text/css" href="style.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
- </head>
- <body>
- <?php
- if(isset($_SESSION["errorx"]) && isset($_SESSION["userx"]) && !empty($_SESSION["userx"]) && intval($_SESSION["errorx"]) === 0){
- unset($_SESSION["errorx"]);
- $user = ucfirst(strtolower($_SESSION["userx"]));
- unset($_SESSION["userx"]);
- echo "<script>
- swal({
- title: 'Success!',
- text: 'You Logged In Succesfuly And Will Be Redirected....',
- icon: 'success',
- button: 'Continue',
- });
- </script>";
- $_SESSION["user"] = $user;
- header("refresh:2;url=/panel/index.php");
- }else if(isset($_SESSION["errorx"]) && !empty($_SESSION["errorx"])){
- $error = strval($_SESSION["errorx"]);
- unset($_SESSION["errorx"]);
- echo "<script>
- swal({
- title: 'Error Occurred!',
- text: '$error',
- icon: 'error',
- button: 'Continue',
- });
- </script>";
- }
- ?>
- <div class="container-fluid bg">
- <div class="row">
- <div class="col-md-4 col-sm-4 col-xs-12"></div>
- <div class="col-md-4 col-sm-4 col-xs-12">
- <form class="form-cont" method="post">
- <h1>Account Login</h1>
- <div class="form-group">
- <label for="user">Username</label>
- <input type="text" class="form-control" name="user" id="user" required>
- </div>
- <div class="form-group">
- <label for="pass">Password</label>
- <input type="password" class="form-control" name="pass" id="pass" required>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" checked> Remeber Me
- </label>
- </div>
- <button type="submit" name="submit" class="btn btn-success btn-block">Login</button><br/>
- <a class="text-center" style="color: #e84118; font-size: 18px; font-weight: bold;" href="register.php">I don't have An Account?</a>
- <a class="text-center" style="color: #e84118; font-size: 18px; font-weight: bold;" href="https://discord.me/">I Forget password? Contact Discord Server</a>
- </form>
- </div>
- <div class="col-md-4 col-sm-4 col-xs-12"></div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement