Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once 'header.php';
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" type="text/css" href="style.css">
- <body>
- <header>
- </header>
- <section>
- <div class="nav-login">
- <form action="includes/loginprocess.php" method="POST">
- <input class="txtbox" type="text" name="username" placeholder="Username"><br>
- <input class="txtbox" type="password" name="userpass" placeholder="Password"><br>
- <button class="good-looking" type="submit" name="submit">Login</button>
- </form>
- </div>
- </section>
- </body>
- </html>
- <?php
- session_start();
- if(isset($_POST['submit'])) {
- include 'dbconn.php';
- $username = mysqli_real_escape($conn, $_POST['username']);
- $userpass = mysqli_real_escape($conn, $_POST['userpass']);
- if (empty($username) || empty($userpass)) {
- header("Location: ../index.php?login=empty");
- exit();
- } else {
- $sql = "SELECT * FROM samokslogin WHERE samokslogin_username='$username'";
- $result = mysqli_query($conn, $sql);
- $reultCheck = mysqli_num_rows($result);
- if($resultCheck < 1) {
- header("Location: ../index.php?login=error");
- exit();
- } else {
- if($row = mysqli_fetch_assoc($result)) {
- $LoginCheck = password_verify($pwd, $row['samokslogin_userpass']);
- if($LoginCheck == false) {
- header("Location: ../index.php?login=failed");
- exit();
- } elseif ($LoginCheck == true) {
- $_SESSION['u_id'] = $row['samokslogin_id'];
- $_SESSION['u_username'] = $row['samokslogin_username'];
- header("Location: ../index.php?login=success");
- exit();
- }
- }
- }
- }
- else {
- header("Location: ../index.php?login=failed");
- exit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement