forgot password? sucks until now! #12

Closed
td00 wants to merge 2 commits from passwordforget into master
2 changed files with 44 additions and 0 deletions

43
forgot.php Normal file
View File

@ -0,0 +1,43 @@
<?php
session_start();
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
if(isset($_GET['login'])) {
$email = $_POST['email'];
$statement = $pdo->prepare("SELECT * FROM users WHERE email = :email");
$result = $statement->execute(array('email' => $email));
$user = $statement->fetch();
if ($user !== true ) {
die('successfull. check your inbox.');
} else {
$errorMessage = "somethings wrong (maybe wrong email?)<br>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Forgot Password</title>
</head>
<body>
<?php
if(isset($errorMessage)) {
echo $errorMessage;
}
?>
<form action="?login=1" method="post">
Your E-Mail Adress:<br>
<input type="text" size="40" maxlength="250" name="email"><br><br>
<input type="submit" value="GO">
</form>
<a href="login.php">i know my password again!</a>
</body>
</html>

View File

@ -45,5 +45,6 @@ Your password:<br>
<input type="submit" value="GO">
</form>
<a href="forgot.php">forgot password</a>
</body>
</html>