Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require("config.php");
- $mysqli = new mysqli($server, $username, $password, $database);
- if (isset($_POST['user']) and isset($_POST['pass']))
- {
- $luser = $_POST['user'];
- $lpass = base64_encode($_POST['pass']);
- $stmt = $mysqli->prepare("SELECT * FROM users WHERE user=? AND pass=?");
- $stmt->bind_param('ss', $luser, $lpass);
- $stmt->execute();
- $stmt->store_Result();
- if ($stmt->num_rows == 1)
- {
- $_SESSION['user'] = $luser;
- header('Location: ?page=upload');
- }
- else
- {
- echo "Login failed.";
- }
- }
- else
- {
- ?>
- <form action="" method="POST">
- <label>Username: </label><input id="user" type="test" name="user"><br />
- <label>Password: </label><input id="pass" type="password" name="pass"><br />
- <input type="submit" name="submit" value="Login">
- </form>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement