Subversion Repositories ALCASAR

Rev

Rev 688 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
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
 
647 richard 6
 
7
 
345 richard 8
require('/etc/freeradius-web/config.php');
9
 
10
$current_page = $_SERVER['PHP_SELF'];
11
 
12
# Choice of language
912 richard 13
$Language = 'en';
345 richard 14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
15
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
17
if($Language == 'es'){
18
$R_title = "User password change";
19
$R_form_l1 = "User";
20
$R_form_l2 = "Old password";
21
$R_form_l3 = "New password";
22
$R_form_l4 = "New password (confirmation)";
647 richard 23
$R_eval_pass = "Score :";
688 richard 24
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
647 richard 25
$R_form_button_valid = "Modify";
26
$R_form_button_retour = "Cancel";
345 richard 27
$R_form_result1 = "Your password has been successfuly changed";
28
$R_form_result2 = "Error when trying to change password";
509 richard 29
$R_retour = "ALCASAR home page";}
912 richard 30
else if ($Language == 'pt'){
31
$R_title = "Alteração de senha do usuário";
32
$R_form_l1 = "Usuário";
33
$R_form_l2 = "Senha antiga";
34
$R_form_l3 = "Nova senha";
35
$R_form_l4 = "Nova senha (confirmação)";
36
$R_eval_pass = "Resultado:";
688 richard 37
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
912 richard 38
$R_form_button_valid = "Modificar";
39
$R_form_button_retour = "Cancelar";
40
$R_form_result1 = "Sua senha foi alterada com sucesso";
41
$R_form_result2 = "Erro ao tentar alterar a senha";
42
$R_retour = "Home page Alcasar";}
43
else if($Language == 'de'){
345 richard 44
$R_title = "User password change";
45
$R_form_l1 = "User";
46
$R_form_l2 = "Old password";
47
$R_form_l3 = "New password";
48
$R_form_l4 = "New password (confirmation)";
647 richard 49
$R_eval_pass = "Score :";
688 richard 50
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
647 richard 51
$R_form_button_valid = "Modify";
52
$R_form_button_retour = "Cancel";
345 richard 53
$R_form_result1 = "Your password has been successfuly changed";
54
$R_form_result2 = "Error when trying to change password";
509 richard 55
$R_retour = "ALCASAR home page";}
912 richard 56
else if($Language == 'nl'){
345 richard 57
$R_title = "User password change";
58
$R_form_l1 = "User";
59
$R_form_l2 = "Old password";
60
$R_form_l3 = "New password";
61
$R_form_l4 = "New password (confirmation)";
647 richard 62
$R_eval_pass = "Score :";
688 richard 63
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
647 richard 64
$R_form_button_valid = "Modify";
65
$R_form_button_retour = "Cancel";
345 richard 66
$R_form_result1 = "Your password has been successfuly changed";
67
$R_form_result2 = "Error when trying to change password";
509 richard 68
$R_retour = "ALCASAR home page";}
912 richard 69
else if($Language == 'fr'){
345 richard 70
$R_title = "Changement de mot de passe utilisateur";
647 richard 71
$R_form_l1 = "Utilisateur :";
72
$R_form_l2 = "Ancien mot de passe :";
73
$R_form_l3 = "Nouveau mot de passe :";
74
$R_form_l4 = "Nouveau mot de passe (confirmation) :";
75
$R_eval_pass = "";
688 richard 76
$R_passwordmeter = "Propulsé par 'Shibbo Password Analyser'</a>";
647 richard 77
$R_form_button_valid = "Modifier";
78
$R_form_button_retour = "Annuler";
345 richard 79
$R_form_result1 = "Votre mot de passe a &eacute;t&eacute; modifi&eacute; avec succ&egrave;s";
80
$R_form_result2 = "Erreur de changement de mot de passe";
912 richard 81
$R_retour = "Retour &agrave; la page d'accueil ALCASAR";}
82
else {
83
$R_title = "User password change";
84
$R_form_l1 = "User";
85
$R_form_l2 = "Old password";
86
$R_form_l3 = "New password";
87
$R_form_l4 = "New password (confirmation)";
88
$R_eval_pass = "Score :";
89
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
90
$R_form_button_valid = "Modify";
91
$R_form_button_retour = "Cancel";
92
$R_form_result1 = "Your password has been successfuly changed";
93
$R_form_result2 = "Error when trying to change password";
94
$R_retour = "ALCASAR home page";
345 richard 95
}
96
echo "
97
<html>
509 richard 98
	<head>
99
		<title>$R_title</title>
100
		<meta http-equiv=\"Cache-control\" content=\"no-cache\">
101
		<meta http-equiv=\"Pragma\" content=\"no-cache\">
102
		<link rel=\"stylesheet\" href=\"../css/pass.css\" type=\"text/css\">
647 richard 103
		<link type=\"text/css\" href=\"../css/pwdmeter.css\" media=\"screen\" rel=\"stylesheet\" />
104
		<!--[if lt IE 7]>
105
			<link type=\"text/css\" href=\"../css/ie.css\" media=\"screen\" rel=\"stylesheet\" />
106
		<![endif]-->
107
		<script type=\"text/javascript\" src=\"js/pwdmeter.js\" language=\"javascript\"></script>
509 richard 108
	</head>
109
	<body>
110
		<div id=\"page\">
111
			<div id=\"block_pass\">
647 richard 112
				<div id=\"pass_chg\">
113
					<img src=\"../images/organisme.png\" />
114
					<h1 id=\"titre_pass\">$R_title</h1>
115
				</div>
116
				<div id=\"pass_chg_content\">
117
					<form name=\"master\" action=\"$current_page\" method=\"post\">
118
					<input type=hidden name=action value=checkpass>
119
						<table id=\"champs_pass\">
120
							<tr>
121
								<td class=\"first_item\">$R_form_l1</td>
122
								<td><input type=\"text\" name=\"login\" value=\"\" label=\"test\"></td>
123
							</tr>
124
							<tr>
125
								<td class=\"first_item\">$R_form_l2</td>
126
								<td><input type=\"password\" name=\"passwd\" value=\"\"></td>
127
							</tr>
128
							<tr>
129
								<td class=\"first_item\">$R_form_l3</td>
130
								<td>
131
									<input type=\"password\" name=\"newpasswd\" id=\"passwordPwd\" value=\"\" autocomplete=\"off\" onkeyup=\"chkPass(this.value);\" />
132
									<input type=\"text\" id=\"passwordTxt\" name=\"passwordTxt\" autocomplete=\"off\" onkeyup=\"chkPass(this.value);\" class=\"hide\" />
133
								</td>
134
							</tr>
135
							<tr>
136
								<td class=\"first_item\">$R_eval_pass</td>
137
								<td>
138
									<div id=\"scorebarBorder\">
139
										<div id=\"score\">0%</div>
140
										<div id=\"scorebar\">&nbsp;</div>
141
									</div>
142
									<div id=\"complexity\"></div>
143
								</td>
144
							</tr>
145
							<tr>
146
								<td colspan=\"2\" id=\"lien_pass\">$R_passwordmeter</td>
147
							</tr>
148
							<tr>
149
								<td class=\"first_item\">$R_form_l4</td>
150
								<td><input type=\"password\" name=\"newpasswd2\" value=\"\"></td>
151
							</tr>
152
						</table>
153
					<input type=\"submit\" class=\"btn_form\" id=\"btn_pass\" value=\"$R_form_button_valid\">
154
					<input type=\"button\" class=\"btn_form\" id=\"btn_retour\" value=\"$R_form_button_retour\" onclick=\"location.replace('http://alcasar');\">
155
				</div>
509 richard 156
			</div>
647 richard 157
			<div id=\"info_pass\">
158
						<table id=\"tablePwdStatus\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\">
159
					<tr>
160
						<th colspan=\"2\">Additions</th>
161
						<th class=\"txtCenter\">Type</th>
162
						<th class=\"txtCenter\">Rate</th>
163
						<th class=\"txtCenter\">Count</th>
164
						<th class=\"txtCenter\">Bonus</th>
165
					</tr>
166
					<tr>
167
						<td width=\"1%\"><div id=\"div_nLength\" class=\"fail\">&nbsp;</div></td>
168
						<td width=\"94%\">Number of Characters</td>
169
						<td width=\"1%\" class=\"txtCenter\">Flat</td>
170
						<td width=\"1%\" class=\"txtCenter italic\">+(n*4)</td>
171
						<td width=\"1%\"><div id=\"nLength\" class=\"box\">&nbsp;</div></td>
172
						<td width=\"1%\"><div id=\"nLengthBonus\" class=\"boxPlus\">&nbsp;</div></td>
173
					</tr>
174
					<tr>
175
						<td><div id=\"div_nAlphaUC\" class=\"fail\">&nbsp;</div></td>
176
						<td>Uppercase Letters</td>
177
						<td class=\"txtCenter\">Cond/Incr</td>
178
						<td nowrap=\"nowrap\" class=\"txtCenter italic\">+((len-n)*2)</td>
179
					   <td><div id=\"nAlphaUC\" class=\"box\">&nbsp;</div></td>
180
						<td><div id=\"nAlphaUCBonus\" class=\"boxPlus\">&nbsp;</div></td>
181
					</tr>
182
					<tr>
183
						<td><div id=\"div_nAlphaLC\" class=\"fail\">&nbsp;</div></td>
184
						<td>Lowercase Letters</td>
185
						<td class=\"txtCenter\">Cond/Incr</td>
186
						<td class=\"txtCenter italic\">+((len-n)*2)</td>
187
						<td><div id=\"nAlphaLC\" class=\"box\">&nbsp;</div></td>
188
						<td><div id=\"nAlphaLCBonus\" class=\"boxPlus\">&nbsp;</div></td>
189
					</tr>
190
					<tr>
191
						<td><div id=\"div_nNumber\" class=\"fail\">&nbsp;</div></td>
192
						<td>Numbers</td>
193
						<td class=\"txtCenter\">Cond</td>
194
						<td class=\"txtCenter italic\">+(n*4)</td>
195
						<td><div id=\"nNumber\" class=\"box\">&nbsp;</div></td>
196
						<td><div id=\"nNumberBonus\" class=\"boxPlus\">&nbsp;</div></td>
197
				   </tr>
198
					<tr>
199
						<td><div id=\"div_nSymbol\" class=\"fail\">&nbsp;</div></td>
200
						<td>Symbols</td>
201
						<td class=\"txtCenter\">Flat</td>
202
						<td class=\"txtCenter italic\">+(n*6)</td>
203
						<td><div id=\"nSymbol\" class=\"box\">&nbsp;</div></td>
204
						<td><div id=\"nSymbolBonus\" class=\"boxPlus\">&nbsp;</div></td>
205
				   </tr>
206
					<tr>
207
						<td><div id=\"div_nMidChar\" class=\"fail\">&nbsp;</div></td>
208
						<td>Middle Numbers or Symbols</td>
209
						<td class=\"txtCenter\">Flat</td>
210
						<td class=\"txtCenter italic\">+(n*2)</td>
211
						<td><div id=\"nMidChar\" class=\"box\">&nbsp;</div></td>
212
						<td><div id=\"nMidCharBonus\" class=\"boxPlus\">&nbsp;</div></td>
213
				   </tr>
214
					<tr>
215
						<td><div id=\"div_nRequirements\" class=\"fail\">&nbsp;</div></td>
216
						<td>Requirements</td>
217
						<td class=\"txtCenter\">Flat</td>
218
						<td class=\"txtCenter italic\">+(n*2)</td>
219
						<td><div id=\"nRequirements\" class=\"box\">&nbsp;</div></td>
220
						<td><div id=\"nRequirementsBonus\" class=\"boxPlus\">&nbsp;</div></td>
221
				   </tr>
222
					<tr>
223
						<th colspan=\"6\">Deductions</th>
224
					</tr>
225
					<tr>
226
						<td width=\"1%\"><div id=\"div_nAlphasOnly\" class=\"pass\">&nbsp;</div></td>
227
						<td width=\"94%\">Letters Only</td>
228
						<td width=\"1%\" class=\"txtCenter\">Flat</td>
229
						<td width=\"1%\" class=\"txtCenter italic\">-n</td>
230
						<td width=\"1%\"><div id=\"nAlphasOnly\" class=\"box\">&nbsp;</div></td>
231
						<td width=\"1%\"><div id=\"nAlphasOnlyBonus\" class=\"boxMinus\">&nbsp;</div></td>
232
					</tr>
233
					<tr>
234
						<td><div id=\"div_nNumbersOnly\" class=\"pass\">&nbsp;</div></td>
235
						<td>Numbers Only</td>
236
						<td class=\"txtCenter\">Flat</td>
237
						<td class=\"txtCenter italic\">-n</td>
238
						<td><div id=\"nNumbersOnly\" class=\"box\">&nbsp;</div></td>
239
						<td><div id=\"nNumbersOnlyBonus\" class=\"boxMinus\">&nbsp;</div></td>
240
					</tr>
241
					<tr>
242
						<td><div id=\"div_nRepChar\" class=\"pass\">&nbsp;</div></td>
243
						<td>Repeat Characters (Case Insensitive)</td>
244
						<td class=\"txtCenter\">Comp</td>
245
						<td nowrap=\"nowrap\" class=\"txtCenter italic\"> - </td>
246
						<td><div id=\"nRepChar\" class=\"box\">&nbsp;</div></td>
247
						<td><div id=\"nRepCharBonus\" class=\"boxMinus\">&nbsp;</div></td>
248
					</tr>
249
					<tr>
250
						<td><div id=\"div_nConsecAlphaUC\" class=\"pass\">&nbsp;</div></td>
251
						<td>Consecutive Uppercase Letters</td>
252
						<td class=\"txtCenter\">Flat</td>
253
						<td class=\"txtCenter italic\">-(n*2)</td>
254
						<td><div id=\"nConsecAlphaUC\" class=\"box\">&nbsp;</div></td>
255
						<td><div id=\"nConsecAlphaUCBonus\" class=\"boxMinus\">&nbsp;</div></td>
256
					</tr>
257
					<tr>
258
						<td><div id=\"div_nConsecAlphaLC\" class=\"pass\">&nbsp;</div></td>
259
						<td>Consecutive Lowercase Letters</td>
260
						<td class=\"txtCenter\">Flat</td>
261
						<td class=\"txtCenter italic\">-(n*2)</td>
262
						<td><div id=\"nConsecAlphaLC\" class=\"box\">&nbsp;</div></td>
263
						<td><div id=\"nConsecAlphaLCBonus\" class=\"boxMinus\">&nbsp;</div></td>
264
					</tr>
265
					<tr>
266
						<td><div id=\"div_nConsecNumber\" class=\"pass\">&nbsp;</div></td>
267
						<td>Consecutive Numbers</td>
268
						<td class=\"txtCenter\">Flat</td>
269
						<td class=\"txtCenter italic\">-(n*2)</td>
270
						<td><div id=\"nConsecNumber\" class=\"box\">&nbsp;</div></td>
271
						<td><div id=\"nConsecNumberBonus\" class=\"boxMinus\">&nbsp;</div></td>
272
					</tr>
273
					<tr>
274
						<td><div id=\"div_nSeqAlpha\" class=\"pass\">&nbsp;</div></td>
275
						<td>Sequential Letters (3+)</td>
276
						<td class=\"txtCenter\">Flat</td>
277
						<td class=\"txtCenter italic\">-(n*3)</td>
278
						<td><div id=\"nSeqAlpha\" class=\"box\">&nbsp;</div></td>
279
						<td><div id=\"nSeqAlphaBonus\" class=\"boxMinus\">&nbsp;</div></td>
280
					</tr>
281
					<tr>
282
						<td><div id=\"div_nSeqNumber\" class=\"pass\">&nbsp;</div></td>
283
						<td>Sequential Numbers (3+)</td>
284
						<td class=\"txtCenter\">Flat</td>
285
						<td class=\"txtCenter italic\">-(n*3)</td>
286
						<td><div id=\"nSeqNumber\" class=\"box\">&nbsp;</div></td>
287
						<td><div id=\"nSeqNumberBonus\" class=\"boxMinus\">&nbsp;</div></td>
288
					</tr>
289
					<tr>
290
						<td><div id=\"div_nSeqSymbol\" class=\"pass\">&nbsp;</div></td>
291
						<td>Sequential Symbols (3+)</td>
292
						<td class=\"txtCenter\">Flat</td>
293
						<td class=\"txtCenter italic\">-(n*3)</td>
294
						<td><div id=\"nSeqSymbol\" class=\"box\">&nbsp;</div></td>
295
						<td><div id=\"nSeqSymbolBonus\" class=\"boxMinus\">&nbsp;</div></td>
296
					</tr>
297
					<tr>
298
						<th colspan=\"6\">Legend</th>
299
					</tr>
300
					<tr>
301
						<td colspan=\"6\">
302
							<ul id=\"listLegend\">
303
								<li><div class=\"exceed imgLegend\">&nbsp;</div> <span class=\"bold\">Exceptional:</span> Exceeds minimum standards. Additional bonuses are applied.</li>
304
								<li><div class=\"pass imgLegend\">&nbsp;</div> <span class=\"bold\">Sufficient:</span> Meets minimum standards. Additional bonuses are applied.</li>
305
								<li><div class=\"warn imgLegend\">&nbsp;</div> <span class=\"bold\">Warning:</span> Advisory against employing bad practices. Overall score is reduced.</li>
306
								<li><div class=\"fail imgLegend\">&nbsp;</div> <span class=\"bold\">Failure:</span> Does not meet the minimum standards. Overall score is reduced.</li>
307
							</ul>
308
						</td>
309
					</tr>
310
				</table>
311
			   <table id=\"tablePwdNotes\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\">
312
					<tr>
313
						<th>Quick Footnotes</th>
314
					</tr>
315
					<tr>
316
						<td>
317
							&bull; <strong>Flat:</strong> Rates that add/remove in non-changing increments.<br />
318
							&bull; <strong>Incr:</strong> Rates that add/remove in adjusting increments.<br />
319
							&bull; <strong>Cond:</strong> Rates that add/remove depending on additional factors.<br />
320
							&bull; <strong>Comp:</strong> Rates that are too complex to summarize. See source code for details.<br />
321
							&bull; <strong>n:</strong> Refers to the total number of occurrences.<br />
322
							&bull; <strong>len:</strong> Refers to the total password length.<br />
323
							&bull; Additional bonus scores are given for increased character variety.<br />
324
							&bull; Final score is a cumulative result of all bonuses minus deductions.<br />
325
							&bull; Final score is capped with a minimum of 0 and a maximum of 100.<br />
326
							&bull; Score and Complexity ratings are not conditional on meeting minimum requirements.<br />
327
						</td>
328
					</tr>
329
					<tr>
330
						<th>DISCLAIMER</th>
331
					</tr>
332
					<tr>
333
						<td>
334
							<p>This application is designed to assess the strength of password strings.  The instantaneous visual feedback provides the user a means to improve the strength of their passwords, with a hard focus on breaking the typical bad habits of faulty password formulation.  Since no official weighting system exists, we created our own formulas to assess the overall strength of a given password.  Please note, that this application does not utilize the typical \"days-to-crack\" approach for strength determination.  We have found that particular system to be severely lacking and unreliable for real-world scenarios.  This application is neither perfect nor foolproof, and should only be utilized as a loose guide in determining methods for improving the password creation process. </p>
335
						</td>
336
					</tr>
337
				</table>
338
			</div>
509 richard 339
		</div>
340
";
345 richard 341
 
342
if (is_file("sql/drivers/$config[sql_type]/functions.php"))
343
	include_once("sql/drivers/$config[sql_type]/functions.php");
344
else{
345
	echo "<b>Could not include SQL library</b><br>\n";
346
	exit();
347
}
348
if (isset($action)){
349
	if ($action == 'checkpass'){
350
	$link = @da_sql_pconnect($config);
647 richard 351
		if ($link){
352
			$res = @da_sql_query($link,$config,
353
				"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login'
354
				AND attribute = '$config[sql_password_attribute]';");
355
			if ($res){
356
				$row = @da_sql_fetch_array($res,$config);
357
				if (is_file("crypt/$config[general_encryption_method].php")){
358
					include("crypt/$config[general_encryption_method].php");
359
					$enc_passwd = $row['value'];
360
					$passwd = da_encrypt($passwd,$enc_passwd);
361
					$newpasswd = da_encrypt($newpasswd,$enc_passwd);
362
					$newpasswd2 = da_encrypt($newpasswd2,$enc_passwd);
363
					if (($passwd == $enc_passwd) and ($newpasswd == $newpasswd2)){
364
						$msg = '<font color=blue><b>'.$R_form_result1.'</b></font>';
365
						$res2 = @da_sql_query($link,$config,
366
							"UPDATE $config[sql_check_table] set value='$newpasswd' WHERE username = '$login'
367
							AND attribute = '$config[sql_password_attribute]';");}
368
					else
369
						$msg = '<font color=red><b>'.$R_form_result2.'</b></font>';
370
				}
345 richard 371
				else
647 richard 372
					echo "<b>Could not open encryption library file</b><br>\n";
345 richard 373
			}
374
		}
647 richard 375
		echo "<span align=center>$msg</span>\n";
345 richard 376
	}
377
}
378
?>
379
</body>
380
</html>