345 |
richard |
1 |
<?php
|
|
|
2 |
# change user password on Alcasar captive Portal
|
|
|
3 |
# Copyright (C) 2003, 2004 Mondru AB.
|
|
|
4 |
# Copyright (C) 2008-2009 ANGEL95 & REXY
|
|
|
5 |
|
|
|
6 |
require('/etc/freeradius-web/config.php');
|
|
|
7 |
|
|
|
8 |
$current_page = $_SERVER['PHP_SELF'];
|
|
|
9 |
|
|
|
10 |
# Choice of language
|
|
|
11 |
$Language = 'fr';
|
|
|
12 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
|
|
13 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
14 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
|
|
15 |
if($Language == 'es'){
|
|
|
16 |
$R_title = "User password change";
|
|
|
17 |
$R_form_l1 = "User";
|
|
|
18 |
$R_form_l2 = "Old password";
|
|
|
19 |
$R_form_l3 = "New password";
|
|
|
20 |
$R_form_l4 = "New password (confirmation)";
|
|
|
21 |
$R_form_button = "Modify";
|
|
|
22 |
$R_form_result1 = "Your password has been successfuly changed";
|
|
|
23 |
$R_form_result2 = "Error when trying to change password";
|
509 |
richard |
24 |
$R_retour = "ALCASAR home page";}
|
345 |
richard |
25 |
if($Language == 'de'){
|
|
|
26 |
$R_title = "User password change";
|
|
|
27 |
$R_form_l1 = "User";
|
|
|
28 |
$R_form_l2 = "Old password";
|
|
|
29 |
$R_form_l3 = "New password";
|
|
|
30 |
$R_form_l4 = "New password (confirmation)";
|
|
|
31 |
$R_form_button = "Modify";
|
|
|
32 |
$R_form_result1 = "Your password has been successfuly changed";
|
|
|
33 |
$R_form_result2 = "Error when trying to change password";
|
509 |
richard |
34 |
$R_retour = "ALCASAR home page";}
|
345 |
richard |
35 |
if($Language == 'nl'){
|
|
|
36 |
$R_title = "User password change";
|
|
|
37 |
$R_form_l1 = "User";
|
|
|
38 |
$R_form_l2 = "Old password";
|
|
|
39 |
$R_form_l3 = "New password";
|
|
|
40 |
$R_form_l4 = "New password (confirmation)";
|
|
|
41 |
$R_form_button = "Modify";
|
|
|
42 |
$R_form_result1 = "Your password has been successfuly changed";
|
|
|
43 |
$R_form_result2 = "Error when trying to change password";
|
509 |
richard |
44 |
$R_retour = "ALCASAR home page";}
|
345 |
richard |
45 |
if($Language == 'en'){
|
|
|
46 |
$R_title = "User password change";
|
|
|
47 |
$R_form_l1 = "User";
|
|
|
48 |
$R_form_l2 = "Old password";
|
|
|
49 |
$R_form_l3 = "New password";
|
|
|
50 |
$R_form_l4 = "New password (confirmation)";
|
|
|
51 |
$R_form_button = "Modify";
|
|
|
52 |
$R_form_result1 = "Your password has been successfuly changed";
|
|
|
53 |
$R_form_result2 = "Error when trying to change password";
|
509 |
richard |
54 |
$R_retour = "ALCASAR home page";}
|
345 |
richard |
55 |
if($Language == 'fr'){
|
|
|
56 |
$R_title = "Changement de mot de passe utilisateur";
|
|
|
57 |
$R_form_l1 = "Utilisateur";
|
|
|
58 |
$R_form_l2 = "Ancien mot de passe";
|
|
|
59 |
$R_form_l3 = "nouveau mot de passe";
|
|
|
60 |
$R_form_l4 = "nouveau mot de passe (confirmation)";
|
|
|
61 |
$R_form_button = "Modifier";
|
|
|
62 |
$R_form_result1 = "Votre mot de passe a été modifié avec succès";
|
|
|
63 |
$R_form_result2 = "Erreur de changement de mot de passe";
|
509 |
richard |
64 |
$R_retour = "Retour à la page d'accueil ALCASAR";
|
345 |
richard |
65 |
}
|
|
|
66 |
echo "
|
|
|
67 |
<html>
|
509 |
richard |
68 |
<head>
|
|
|
69 |
<title>$R_title</title>
|
|
|
70 |
<meta http-equiv=\"Cache-control\" content=\"no-cache\">
|
|
|
71 |
<meta http-equiv=\"Pragma\" content=\"no-cache\">
|
|
|
72 |
<link rel=\"stylesheet\" href=\"../css/pass.css\" type=\"text/css\">
|
|
|
73 |
</head>
|
|
|
74 |
<body>
|
|
|
75 |
<div id=\"page\">
|
|
|
76 |
<div id=\"block_pass\">
|
|
|
77 |
<form name=\"master\" action=\"$current_page\" method=\"post\">
|
|
|
78 |
<input type=hidden name=action value=checkpass>
|
|
|
79 |
<p id=\"titre_pass\">$R_title</p>
|
|
|
80 |
<table id=\"champs_pass\">
|
|
|
81 |
<tr>
|
|
|
82 |
<td class=\"first_item\">$R_form_l1</td>
|
|
|
83 |
<td><input type=\"text\" name=\"login\" value=\"\" label=\"test\"></td>
|
|
|
84 |
</tr>
|
|
|
85 |
<tr>
|
|
|
86 |
<td class=\"first_item\">$R_form_l2</td>
|
|
|
87 |
<td><input type=\"password\" name=\"passwd\" value=\"\"></td>
|
|
|
88 |
</tr>
|
|
|
89 |
<tr>
|
|
|
90 |
<td class=\"first_item\">$R_form_l3</td>
|
|
|
91 |
<td><input type=\"password\" name=\"newpasswd\" value=\"\"></td>
|
|
|
92 |
</tr>
|
|
|
93 |
<tr>
|
|
|
94 |
<td class=\"first_item\">$R_form_l4</td>
|
|
|
95 |
<td><input type=\"password\" name=\"newpasswd2\" value=\"\"></td>
|
|
|
96 |
</tr>
|
|
|
97 |
</table>
|
|
|
98 |
<span><a href=\"http://alcasar\">$R_retour</a></span>
|
|
|
99 |
<input type=\"submit\" class=\"button\" id=\"btn_pass\" value=\"$R_form_button\">
|
|
|
100 |
</div>
|
|
|
101 |
</div>
|
|
|
102 |
";
|
345 |
richard |
103 |
|
|
|
104 |
if (is_file("sql/drivers/$config[sql_type]/functions.php"))
|
|
|
105 |
include_once("sql/drivers/$config[sql_type]/functions.php");
|
|
|
106 |
else{
|
|
|
107 |
echo "<b>Could not include SQL library</b><br>\n";
|
|
|
108 |
exit();
|
|
|
109 |
}
|
|
|
110 |
if (isset($action)){
|
|
|
111 |
if ($action == 'checkpass'){
|
|
|
112 |
$link = @da_sql_pconnect($config);
|
|
|
113 |
if ($link){
|
|
|
114 |
$res = @da_sql_query($link,$config,
|
|
|
115 |
"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login'
|
|
|
116 |
AND attribute = '$config[sql_password_attribute]';");
|
|
|
117 |
if ($res){
|
|
|
118 |
$row = @da_sql_fetch_array($res,$config);
|
|
|
119 |
if (is_file("crypt/$config[general_encryption_method].php")){
|
|
|
120 |
include("crypt/$config[general_encryption_method].php");
|
|
|
121 |
$enc_passwd = $row['value'];
|
|
|
122 |
$passwd = da_encrypt($passwd,$enc_passwd);
|
|
|
123 |
$newpasswd = da_encrypt($newpasswd,$enc_passwd);
|
|
|
124 |
$newpasswd2 = da_encrypt($newpasswd2,$enc_passwd);
|
|
|
125 |
if (($passwd == $enc_passwd) and ($newpasswd == $newpasswd2)){
|
|
|
126 |
$msg = '<font color=blue><b>'.$R_form_result1.'</b></font>';
|
|
|
127 |
$res2 = @da_sql_query($link,$config,
|
|
|
128 |
"UPDATE $config[sql_check_table] set value='$newpasswd' WHERE username = '$login'
|
|
|
129 |
AND attribute = '$config[sql_password_attribute]';");}
|
|
|
130 |
else
|
|
|
131 |
$msg = '<font color=red><b>'.$R_form_result2.'</b></font>';
|
|
|
132 |
}
|
|
|
133 |
else
|
|
|
134 |
echo "<b>Could not open encryption library file</b><br>\n";
|
|
|
135 |
}
|
|
|
136 |
}
|
509 |
richard |
137 |
echo "<span align=center>$msg</span>\n";
|
345 |
richard |
138 |
}
|
|
|
139 |
}
|
|
|
140 |
?>
|
|
|
141 |
</body>
|
|
|
142 |
</html>
|