Subversion Repositories ALCASAR

Rev

Details | 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
13
$Language = 'fr';
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";}
345 richard 30
if($Language == 'de'){
31
$R_title = "User password change";
32
$R_form_l1 = "User";
33
$R_form_l2 = "Old password";
34
$R_form_l3 = "New password";
35
$R_form_l4 = "New password (confirmation)";
647 richard 36
$R_eval_pass = "Score :";
688 richard 37
$R_passwordmeter = "Powered by 'Shibbo Password Analyser'</a>";
647 richard 38
$R_form_button_valid = "Modify";
39
$R_form_button_retour = "Cancel";
345 richard 40
$R_form_result1 = "Your password has been successfuly changed";
41
$R_form_result2 = "Error when trying to change password";
509 richard 42
$R_retour = "ALCASAR home page";}
345 richard 43
if($Language == 'nl'){
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";}
345 richard 56
if($Language == 'en'){
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";}
345 richard 69
if($Language == 'fr'){
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";
509 richard 81
$R_retour = "Retour &agrave; la page d'accueil ALCASAR";
345 richard 82
}
83
echo "
84
<html>
509 richard 85
	<head>
86
		<title>$R_title</title>
87
		<meta http-equiv=\"Cache-control\" content=\"no-cache\">
88
		<meta http-equiv=\"Pragma\" content=\"no-cache\">
89
		<link rel=\"stylesheet\" href=\"../css/pass.css\" type=\"text/css\">
647 richard 90
		<link type=\"text/css\" href=\"../css/pwdmeter.css\" media=\"screen\" rel=\"stylesheet\" />
91
		<!--[if lt IE 7]>
92
			<link type=\"text/css\" href=\"../css/ie.css\" media=\"screen\" rel=\"stylesheet\" />
93
		<![endif]-->
94
		<script type=\"text/javascript\" src=\"js/pwdmeter.js\" language=\"javascript\"></script>	
509 richard 95
	</head>
96
	<body>
97
		<div id=\"page\">
98
			<div id=\"block_pass\">
647 richard 99
				<div id=\"pass_chg\">	
100
					<img src=\"../images/organisme.png\" />
101
					<h1 id=\"titre_pass\">$R_title</h1>
102
				</div>
103
				<div id=\"pass_chg_content\">
104
					<form name=\"master\" action=\"$current_page\" method=\"post\">
105
					<input type=hidden name=action value=checkpass>
106
						<table id=\"champs_pass\">
107
							<tr>
108
								<td class=\"first_item\">$R_form_l1</td>
109
								<td><input type=\"text\" name=\"login\" value=\"\" label=\"test\"></td>
110
							</tr>	
111
							<tr>
112
								<td class=\"first_item\">$R_form_l2</td>
113
								<td><input type=\"password\" name=\"passwd\" value=\"\"></td>
114
							</tr>
115
							<tr>
116
								<td class=\"first_item\">$R_form_l3</td>
117
								<td>
118
									<input type=\"password\" name=\"newpasswd\" id=\"passwordPwd\" value=\"\" autocomplete=\"off\" onkeyup=\"chkPass(this.value);\" />
119
									<input type=\"text\" id=\"passwordTxt\" name=\"passwordTxt\" autocomplete=\"off\" onkeyup=\"chkPass(this.value);\" class=\"hide\" />
120
								</td>
121
							</tr>
122
							<tr>
123
								<td class=\"first_item\">$R_eval_pass</td>
124
								<td>
125
									<div id=\"scorebarBorder\">
126
										<div id=\"score\">0%</div>
127
										<div id=\"scorebar\">&nbsp;</div>
128
									</div>
129
									<div id=\"complexity\"></div>
130
								</td>
131
							</tr>
132
							<tr>
133
								<td colspan=\"2\" id=\"lien_pass\">$R_passwordmeter</td>
134
							</tr>
135
							<tr>
136
								<td class=\"first_item\">$R_form_l4</td>
137
								<td><input type=\"password\" name=\"newpasswd2\" value=\"\"></td>
138
							</tr>
139
						</table>
140
					<input type=\"submit\" class=\"btn_form\" id=\"btn_pass\" value=\"$R_form_button_valid\">
141
					<input type=\"button\" class=\"btn_form\" id=\"btn_retour\" value=\"$R_form_button_retour\" onclick=\"location.replace('http://alcasar');\">
142
				</div>
509 richard 143
			</div>
647 richard 144
			<div id=\"info_pass\">
145
						<table id=\"tablePwdStatus\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\">
146
					<tr>
147
						<th colspan=\"2\">Additions</th>
148
						<th class=\"txtCenter\">Type</th>
149
						<th class=\"txtCenter\">Rate</th>
150
						<th class=\"txtCenter\">Count</th>
151
						<th class=\"txtCenter\">Bonus</th>
152
					</tr>
153
					<tr>
154
						<td width=\"1%\"><div id=\"div_nLength\" class=\"fail\">&nbsp;</div></td>
155
						<td width=\"94%\">Number of Characters</td>
156
						<td width=\"1%\" class=\"txtCenter\">Flat</td>
157
						<td width=\"1%\" class=\"txtCenter italic\">+(n*4)</td>
158
						<td width=\"1%\"><div id=\"nLength\" class=\"box\">&nbsp;</div></td>
159
						<td width=\"1%\"><div id=\"nLengthBonus\" class=\"boxPlus\">&nbsp;</div></td>
160
					</tr>	
161
					<tr>
162
						<td><div id=\"div_nAlphaUC\" class=\"fail\">&nbsp;</div></td>
163
						<td>Uppercase Letters</td>
164
						<td class=\"txtCenter\">Cond/Incr</td>
165
						<td nowrap=\"nowrap\" class=\"txtCenter italic\">+((len-n)*2)</td>
166
					   <td><div id=\"nAlphaUC\" class=\"box\">&nbsp;</div></td>
167
						<td><div id=\"nAlphaUCBonus\" class=\"boxPlus\">&nbsp;</div></td>
168
					</tr>	
169
					<tr>
170
						<td><div id=\"div_nAlphaLC\" class=\"fail\">&nbsp;</div></td>
171
						<td>Lowercase Letters</td>
172
						<td class=\"txtCenter\">Cond/Incr</td>
173
						<td class=\"txtCenter italic\">+((len-n)*2)</td>
174
						<td><div id=\"nAlphaLC\" class=\"box\">&nbsp;</div></td>
175
						<td><div id=\"nAlphaLCBonus\" class=\"boxPlus\">&nbsp;</div></td>
176
					</tr>
177
					<tr>
178
						<td><div id=\"div_nNumber\" class=\"fail\">&nbsp;</div></td>
179
						<td>Numbers</td>
180
						<td class=\"txtCenter\">Cond</td>
181
						<td class=\"txtCenter italic\">+(n*4)</td>
182
						<td><div id=\"nNumber\" class=\"box\">&nbsp;</div></td>
183
						<td><div id=\"nNumberBonus\" class=\"boxPlus\">&nbsp;</div></td>
184
				   </tr>
185
					<tr>
186
						<td><div id=\"div_nSymbol\" class=\"fail\">&nbsp;</div></td>
187
						<td>Symbols</td>
188
						<td class=\"txtCenter\">Flat</td>
189
						<td class=\"txtCenter italic\">+(n*6)</td>
190
						<td><div id=\"nSymbol\" class=\"box\">&nbsp;</div></td>
191
						<td><div id=\"nSymbolBonus\" class=\"boxPlus\">&nbsp;</div></td>
192
				   </tr>
193
					<tr>
194
						<td><div id=\"div_nMidChar\" class=\"fail\">&nbsp;</div></td>
195
						<td>Middle Numbers or Symbols</td>
196
						<td class=\"txtCenter\">Flat</td>
197
						<td class=\"txtCenter italic\">+(n*2)</td>
198
						<td><div id=\"nMidChar\" class=\"box\">&nbsp;</div></td>
199
						<td><div id=\"nMidCharBonus\" class=\"boxPlus\">&nbsp;</div></td>
200
				   </tr>
201
					<tr>
202
						<td><div id=\"div_nRequirements\" class=\"fail\">&nbsp;</div></td>
203
						<td>Requirements</td>
204
						<td class=\"txtCenter\">Flat</td>
205
						<td class=\"txtCenter italic\">+(n*2)</td>
206
						<td><div id=\"nRequirements\" class=\"box\">&nbsp;</div></td>
207
						<td><div id=\"nRequirementsBonus\" class=\"boxPlus\">&nbsp;</div></td>
208
				   </tr>
209
					<tr>
210
						<th colspan=\"6\">Deductions</th>
211
					</tr>
212
					<tr>
213
						<td width=\"1%\"><div id=\"div_nAlphasOnly\" class=\"pass\">&nbsp;</div></td>
214
						<td width=\"94%\">Letters Only</td>
215
						<td width=\"1%\" class=\"txtCenter\">Flat</td>
216
						<td width=\"1%\" class=\"txtCenter italic\">-n</td>
217
						<td width=\"1%\"><div id=\"nAlphasOnly\" class=\"box\">&nbsp;</div></td>
218
						<td width=\"1%\"><div id=\"nAlphasOnlyBonus\" class=\"boxMinus\">&nbsp;</div></td>
219
					</tr>	
220
					<tr>
221
						<td><div id=\"div_nNumbersOnly\" class=\"pass\">&nbsp;</div></td>
222
						<td>Numbers Only</td>
223
						<td class=\"txtCenter\">Flat</td>
224
						<td class=\"txtCenter italic\">-n</td>
225
						<td><div id=\"nNumbersOnly\" class=\"box\">&nbsp;</div></td>
226
						<td><div id=\"nNumbersOnlyBonus\" class=\"boxMinus\">&nbsp;</div></td>
227
					</tr>	
228
					<tr>
229
						<td><div id=\"div_nRepChar\" class=\"pass\">&nbsp;</div></td>
230
						<td>Repeat Characters (Case Insensitive)</td>
231
						<td class=\"txtCenter\">Comp</td>
232
						<td nowrap=\"nowrap\" class=\"txtCenter italic\"> - </td>
233
						<td><div id=\"nRepChar\" class=\"box\">&nbsp;</div></td>
234
						<td><div id=\"nRepCharBonus\" class=\"boxMinus\">&nbsp;</div></td>
235
					</tr>	
236
					<tr>
237
						<td><div id=\"div_nConsecAlphaUC\" class=\"pass\">&nbsp;</div></td>
238
						<td>Consecutive Uppercase Letters</td>
239
						<td class=\"txtCenter\">Flat</td>
240
						<td class=\"txtCenter italic\">-(n*2)</td>
241
						<td><div id=\"nConsecAlphaUC\" class=\"box\">&nbsp;</div></td>
242
						<td><div id=\"nConsecAlphaUCBonus\" class=\"boxMinus\">&nbsp;</div></td>
243
					</tr>	
244
					<tr>
245
						<td><div id=\"div_nConsecAlphaLC\" class=\"pass\">&nbsp;</div></td>
246
						<td>Consecutive Lowercase Letters</td>
247
						<td class=\"txtCenter\">Flat</td>
248
						<td class=\"txtCenter italic\">-(n*2)</td>
249
						<td><div id=\"nConsecAlphaLC\" class=\"box\">&nbsp;</div></td>
250
						<td><div id=\"nConsecAlphaLCBonus\" class=\"boxMinus\">&nbsp;</div></td>
251
					</tr>	
252
					<tr>
253
						<td><div id=\"div_nConsecNumber\" class=\"pass\">&nbsp;</div></td>
254
						<td>Consecutive Numbers</td>
255
						<td class=\"txtCenter\">Flat</td>
256
						<td class=\"txtCenter italic\">-(n*2)</td>
257
						<td><div id=\"nConsecNumber\" class=\"box\">&nbsp;</div></td>
258
						<td><div id=\"nConsecNumberBonus\" class=\"boxMinus\">&nbsp;</div></td>
259
					</tr>	
260
					<tr>
261
						<td><div id=\"div_nSeqAlpha\" class=\"pass\">&nbsp;</div></td>
262
						<td>Sequential Letters (3+)</td>
263
						<td class=\"txtCenter\">Flat</td>
264
						<td class=\"txtCenter italic\">-(n*3)</td>
265
						<td><div id=\"nSeqAlpha\" class=\"box\">&nbsp;</div></td>
266
						<td><div id=\"nSeqAlphaBonus\" class=\"boxMinus\">&nbsp;</div></td>
267
					</tr>	
268
					<tr>
269
						<td><div id=\"div_nSeqNumber\" class=\"pass\">&nbsp;</div></td>
270
						<td>Sequential Numbers (3+)</td>
271
						<td class=\"txtCenter\">Flat</td>
272
						<td class=\"txtCenter italic\">-(n*3)</td>
273
						<td><div id=\"nSeqNumber\" class=\"box\">&nbsp;</div></td>
274
						<td><div id=\"nSeqNumberBonus\" class=\"boxMinus\">&nbsp;</div></td>
275
					</tr>	
276
					<tr>
277
						<td><div id=\"div_nSeqSymbol\" class=\"pass\">&nbsp;</div></td>
278
						<td>Sequential Symbols (3+)</td>
279
						<td class=\"txtCenter\">Flat</td>
280
						<td class=\"txtCenter italic\">-(n*3)</td>
281
						<td><div id=\"nSeqSymbol\" class=\"box\">&nbsp;</div></td>
282
						<td><div id=\"nSeqSymbolBonus\" class=\"boxMinus\">&nbsp;</div></td>
283
					</tr>	
284
					<tr>
285
						<th colspan=\"6\">Legend</th>
286
					</tr>
287
					<tr>
288
						<td colspan=\"6\">
289
							<ul id=\"listLegend\">
290
								<li><div class=\"exceed imgLegend\">&nbsp;</div> <span class=\"bold\">Exceptional:</span> Exceeds minimum standards. Additional bonuses are applied.</li>
291
								<li><div class=\"pass imgLegend\">&nbsp;</div> <span class=\"bold\">Sufficient:</span> Meets minimum standards. Additional bonuses are applied.</li>
292
								<li><div class=\"warn imgLegend\">&nbsp;</div> <span class=\"bold\">Warning:</span> Advisory against employing bad practices. Overall score is reduced.</li>
293
								<li><div class=\"fail imgLegend\">&nbsp;</div> <span class=\"bold\">Failure:</span> Does not meet the minimum standards. Overall score is reduced.</li>
294
							</ul>
295
						</td>
296
					</tr>
297
				</table>
298
			   <table id=\"tablePwdNotes\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\">
299
					<tr>
300
						<th>Quick Footnotes</th>
301
					</tr>
302
					<tr>
303
						<td>
304
							&bull; <strong>Flat:</strong> Rates that add/remove in non-changing increments.<br />
305
							&bull; <strong>Incr:</strong> Rates that add/remove in adjusting increments.<br />
306
							&bull; <strong>Cond:</strong> Rates that add/remove depending on additional factors.<br />
307
							&bull; <strong>Comp:</strong> Rates that are too complex to summarize. See source code for details.<br />
308
							&bull; <strong>n:</strong> Refers to the total number of occurrences.<br />
309
							&bull; <strong>len:</strong> Refers to the total password length.<br />
310
							&bull; Additional bonus scores are given for increased character variety.<br />
311
							&bull; Final score is a cumulative result of all bonuses minus deductions.<br />
312
							&bull; Final score is capped with a minimum of 0 and a maximum of 100.<br />
313
							&bull; Score and Complexity ratings are not conditional on meeting minimum requirements.<br />
314
						</td>
315
					</tr>
316
					<tr>
317
						<th>DISCLAIMER</th>
318
					</tr>
319
					<tr>
320
						<td>
321
							<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>
322
						</td>
323
					</tr>
324
				</table>
325
			</div>
509 richard 326
		</div>
327
";
345 richard 328
 
329
if (is_file("sql/drivers/$config[sql_type]/functions.php"))
330
	include_once("sql/drivers/$config[sql_type]/functions.php");
331
else{
332
	echo "<b>Could not include SQL library</b><br>\n";
333
	exit();
334
}
335
if (isset($action)){
336
	if ($action == 'checkpass'){
337
	$link = @da_sql_pconnect($config);
647 richard 338
		if ($link){
339
			$res = @da_sql_query($link,$config,
340
				"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login'
341
				AND attribute = '$config[sql_password_attribute]';");
342
			if ($res){
343
				$row = @da_sql_fetch_array($res,$config);
344
				if (is_file("crypt/$config[general_encryption_method].php")){
345
					include("crypt/$config[general_encryption_method].php");
346
					$enc_passwd = $row['value'];
347
					$passwd = da_encrypt($passwd,$enc_passwd);
348
					$newpasswd = da_encrypt($newpasswd,$enc_passwd);
349
					$newpasswd2 = da_encrypt($newpasswd2,$enc_passwd);
350
					if (($passwd == $enc_passwd) and ($newpasswd == $newpasswd2)){
351
						$msg = '<font color=blue><b>'.$R_form_result1.'</b></font>';
352
						$res2 = @da_sql_query($link,$config,
353
							"UPDATE $config[sql_check_table] set value='$newpasswd' WHERE username = '$login'
354
							AND attribute = '$config[sql_password_attribute]';");}
355
					else
356
						$msg = '<font color=red><b>'.$R_form_result2.'</b></font>';
357
				}
345 richard 358
				else
647 richard 359
					echo "<b>Could not open encryption library file</b><br>\n";
345 richard 360
			}
361
		}
647 richard 362
		echo "<span align=center>$msg</span>\n";
345 richard 363
	}
364
}
365
?>
366
</body>
367
</html>