-
Notifications
You must be signed in to change notification settings - Fork 0
/
mypassword.php
59 lines (55 loc) · 1.56 KB
/
mypassword.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
<?php
include("./config.php");
$fl = new TemplatePower("./templates/mypassword.tpl");
require("./header.php");
if(isset($login)&&$login==1 || isset($authenticated)&&$authenticated==1)
{
$fl->assign("_ROOT.SITENAAM", $sitenaam." / Change Password");
if(isset($_POST['changepass']))
{
if(md5($_POST['oldpass'])==$cookiepass)
{
if($_POST['newpass1']==$_POST['newpass2'])
{
$newpassenc=md5($_POST['newpass1']);
$pquery="UPDATE fl_users SET passwd='".$newpassenc."' WHERE user='".$username."'";
$presult=mysql_query($pquery);
if($presult==1)
{
logout_user();
header("location: ".$fileroot."/my.php");
}
else
{
report_error("mypassword.php", mysql_error());
$fl->newBlock("feedback");
$fl->newBlock("FEEDBACK", "Something went wrong while trying to update your password. The librarians have been notified. Please try again later");
}
}
else
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "The new passwords you entered aren't the same. Please try again");
$fl->newBlock("passform");
}
}
else
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "Your old password is incorrect, please try again");
$fl->newBlock("passform");
}
}
else
{
$fl->newBlock("passform");
}
}
else
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "You need to be logged in to use the personal account pages. If you don't have an account yet, you can <a href=\"signup.php\">sign up for an account here</a>");
$fl->assign("_ROOT.SITENAAM", $sitenaam." / Please log in");
}
$fl->printToScreen();
?>