This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforgotpassword.php
More file actions
56 lines (50 loc) · 1.97 KB
/
forgotpassword.php
File metadata and controls
56 lines (50 loc) · 1.97 KB
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
<?php
//Use unified password reset script
header('Location: https://igroups.iit.edu/userpassword/index.php?reset=1', true, 302);
exit;
include_once('globals.php');
if(isset($_POST['resetPW']))
{
setcookie('username', '', time()-60);
setcookie('password', '', time()-60);
}
//------Start XHTML Output--------------------------------------//
require('doctype.php');
require('appearance.php');
echo "<link rel=\"stylesheet\" href=\"skins/$skin/default.css\" type=\"text/css\" title=\"$skin\" />\n";
foreach($altskins as $altskin)
echo "<link rel=\"alternate stylesheet\" href=\"skins/$altskin/default.css\" type=\"text/css\" title=\"$altskin\" />\n";
?>
<title><?php echo $appname; ?> - Forgotten Password</title>
</head>
<body>
<?php
require("sidebar.php");
?>
<div id="content"><h1>Password Reset Form</h1>
<?php
require_once("classes/db.php");
require_once("classes/person.php");
if(isset($_POST['resetPW']))
{
$db = new dbConnection();
$ur = $db->query("SELECT iID FROM People WHERE sEmail='".$_POST['email']."'");
if($row = mysql_fetch_row($ur))
{
for($i = 0; $i < 8; $i++)
$pw .= chr(rand(65, 90));
$user = new Person($row[0], $db);
$user->setPassword($pw);
$user->updateDB();
mail($_POST['email'], "Your $appname password has been reset", "Your password is:\n$pw\nPasswords are case-sensitive.\nYou should change your password (in My Profile) the next time you log in.", "From: $contactemail");
echo "<p>Your password has been reset. An email has been sent to you containing your new password.</p>\n";
}
else
echo "<p class=\"errorText\">Invalid email address</p>\n";
}
?>
<p>To reset your password, simply enter your email address in the form below. An email will be sent to you containing a new password.</p>
<form action="forgotpassword.php" method="post"><fieldset>
<label>Enter email address: <input type="text" name="email" /></label>
<input type="submit" name="resetPW" value="Reset Password" />
</fieldset></form></div></body></html>