Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'db_conn.php';
- session_start();
- ob_start();
- ?>
- <html>
- <head>
- <title>Log In</title>
- </head>
- <body>
- <h1 style="text-align: center; border: thin solid #ffa500; color: aqua; font-style: bold">Log In</h1>
- <form>
- <table>
- <tr>
- <td>
- <p>Username</p>
- </td>
- <td>
- <input type="text" name="username" method="get" required>
- </td>
- <tr>
- <tr>
- <td>
- <p>Password</p>
- </td>
- <td>
- <input type="password" name="password" method="get" required>
- </td>
- </tr>
- <tr>
- <td>
- <p>Security Code</p>
- </td>
- <td>
- <input type="text" name="security_code" method="get" required>
- </td>
- </tr>
- </table>
- <input type="submit" name="submit_user_details">
- </form>
- <?php
- if($_SESSION['uid'])
- {
- echo "You are already logged in!<br>";
- }
- else
- {
- echo "You are not logged in<br>";
- }
- $username = $_GET['username'];
- $password = $_GET['password'];
- $security_code = $_GET['security_code'];
- $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
- $result = mysqli_query($conn, $sql);
- if(!$result)
- {
- die('Could not get data: ' . mysqli_error($conn));
- }
- if(!$row == mysqli_fetch_assoc($result))
- {
- echo "You have entered an incorrect username or password (if you have not yet entered anything, ignore this, it is a bug)";
- }
- else
- {
- if($security_code == "warframescrub7")
- {
- $_SESSION['uid'] = $row['user_id'];
- $x = $_SESSION['uid'];
- $sql = "UPDATE users SET loggedin='1'
- WHERE user_id='$x'";
- $result = mysqli_query($conn, $sql);
- header('Location: index.php');
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement