-
Notifications
You must be signed in to change notification settings - Fork 3
/
passwd.php
99 lines (93 loc) · 2.49 KB
/
passwd.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
$id="passwd";
ini_set('include_path', 'inc');
include("db.php");
include("define.php");
include("head.php");
include_once("passwdfkt.php");
?>
<?php
function pPassForm()
{
echo "<p><form method='post' action='passwd.php'>\n";
echo "<table>";
echo "<tr><td>Username</td>";
echo "<td><input type='text' name='user' size=10 readonly value='" . $_SERVER["REMOTE_USER"] . "'></td></tr>\n";
echo "<tr><td>Passwort alt</td>";
echo "<td><input type='password' name='pass1' size=20></td></tr>\n";
echo "<tr><td>Passwort neu</td>";
echo "<td><input type='password' name='pass2' size=20></td></tr>\n";
echo "<tr><td>Wiederholung</td>";
echo "<td><input type='password' name='pass3' size=20></td></tr>\n";
echo "</table>";
echo "<input type='submit' name='submit_pass1' value='OK'>\n";
echo "</form></p>\n";
}
function pPassSet($User,$Pass1,$Pass2)
{
$res=pCheckPasswd($User,$Pass1);
if ($res>0)
{
die("Nanu, User ist nicht konfiguriert");
return;
}
if ($res<0)
{
errmsg("Das alte Passwort ist falsch");
pPassForm();
return;
}
pSetPasswd($User,$Pass2);
echo "<p>Das Passwort wurde erfolgreich gesetzt</p>\n";
return;
}
$User="";
$Pass1="";
$Pass2="";
$Pass3="";
if (isset($_POST['user']))
{
$User=preg_replace("/[^0-9a-zA-Z]/","",$_POST['user']);
}
if (isset($_POST['pass1']))
{
$Pass1=preg_replace($pass_chr,"",$_POST['pass1']);
if ($Pass1=="")
errmsg("Das alte Passwort muss angegeben werden");
}
if (isset($_POST['pass2']))
{
$Pass2=preg_replace($pass_chr,"",$_POST['pass2']);
if ($Pass2 != $_POST['pass2'])
{
errmsg($pass_err);
$Pass2="";
}
else if ($Pass2=="")
errmsg("Es muss ein neues Passwort angegeben sein");
}
if (isset($_POST['pass3']))
{
$Pass3=preg_replace($pass_chr,"",$_POST['pass3']);
if ($Pass3=="" && $Pass2!="")
errmsg("Das Passwort muss wiederholt werden");
else if ($Pass3 != $Pass2 && $Pass2!="")
{
errmsg("Die Wiederholung stimmt nicht mit dem neuen Passwort überein");
$Pass3="";
}
}
if (isset($_POST['submit_pass1']) && $_POST['submit_pass1'] = 'OK' &&
$User!="" && $Pass1!="" && $Pass2!="" && $Pass3!="")
{
if ($User != $_SERVER["REMOTE_USER"])
die("You are using this formular under abnormal conditions ;)");
else
pPassSet($User,$Pass1,$Pass2);
}
else
pPassForm();
?>
<?php
include("footer.php");
?>