-
Notifications
You must be signed in to change notification settings - Fork 0
/
requestPasswordChange.php
65 lines (48 loc) · 1.76 KB
/
requestPasswordChange.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* @author Simon Hintersonnleitner <[email protected]>
* Meine Lieblingsorte ist ein MultiMediaProjekt 1 des Studiengangs MultimediaTechnology der Fachhochschule Salzburg.
*/
include "system/php/functions.php";
$pagetitle = "Meine Lieblingsorte";
$error = "";
//check email and send resetmail
if(isset($_POST["reset"]))
{
//check if email address is in database
$stm = $dbh->prepare("SELECT count(*) as count, id, firstname, email FROM user WHERE email = ?");
$stm->execute(array($_POST["email"]));
$response = $stm->fetch();
if($response->count != 0)
{
$stm = $dbh->prepare("INSERT INTO reset (resetKey,userId) VALUES (?,?);");
$key = md5(microtime().rand());
$stm->execute(array($key,$response->id));
sendResetEmail($response->email,$response->firstname,$key);
header("Location:login.php?msgId=4");
exit;
}
else
{
$error = "<br>Benutzername nicht vorhanden!";
}
}
include "template/beginHeader.php";
?>
<link rel="stylesheet" type="text/css" href="system/css/login.css">
<?php
include "template/endHeader.php";
?>
<div class="container">
<img src="img/logo_new.png" href="login.php">
<?php if($error == ""):?>
<div class="alert alert-info"><small>Gib bitte deine <b>E-Mail Adresse</b> ein um dein Passwort zurückzusetzen.</small></div>
<?php else:?>
<div class="alert alert-danger"><small><?php echo $error; ?></small></div>
<?php endif;?>
<form class="form-signin center" role="form" action="requestPasswordChange.php" method="post">
<input type="email" name="email" class="form-control " placeholder="Email-Adresse">
<input type="submit" name="reset" class="form-control input-sm" value="Senden">
</form>
</div>
<?php include 'template/footer.php'; ?>