Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- session_start();
- $error = "Could not connect to database";
- mysql_connect('localhost', 'root', '') or die(mysql_error());
- mysql_select_db('forum') or die(mysql_error());
- require 'forum/includes/functions.php';
- if (isset($_POST['login'])) {
- $username = addslashes(strip_tags(strtolower($_POST['username'])));
- $password = addslashes(strip_tags($_POST['password']));
- }
- if (!$username || !$password) {
- echo 'Please enter a username and password';
- } else {
- $find = mysql_query("SELECT * FROM `phpbb_users` WHERE `username_clean` = '$username'") or die(mysql_error());
- if (mysql_num_rows($find) == 0) {
- echo 'Username not found';
- } else {
- while ($find_row = mysql_fetch_assoc($find)) {
- $paasword_hash = $find_row['user_password'];
- }
- $check = phpbb_check_hash($password, $password_hash);
- }if ($check == FALSE) {
- echo 'Incorrect password';
- } else
- if ($check == TRUE) {
- $_SESSION['username'] = $username;
- header('Location: main.php');
- exit();
- }
- }
- ?>
- <form action="login.php" method="">
- Username: <br>
- <input type="text" name="username"><p/>
- Password: <br/>
- <input type="password" name="password"/><p/>
- <input type="submit" name="login" value="Log in"/>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement