File: password_check.php3

package info (click to toggle)
freeradius 2.0.4%2Bdfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,884 kB
  • ctags: 9,109
  • sloc: ansic: 73,328; sh: 12,392; php: 6,679; perl: 3,075; makefile: 1,316; sql: 1,197; python: 171; tcl: 35; sed: 23
file content (34 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (2)
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
<?php
require('password.php3');
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
else{
	echo "<b>Could not include SQL library</b><br>\n";
	exit();
}

if ($action == 'checkpass'){
	$link = @da_sql_pconnect($config);
	if ($link){
		$res = @da_sql_query($link,$config,
			"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login'
			AND attribute = '$config[sql_password_attribute]';");
		if ($res){
			$row = @da_sql_fetch_array($res,$config);
			if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
				include("../lib/crypt/$config[general_encryption_method].php3");
				$enc_passwd = $row[value];
				$passwd = da_encrypt($passwd,$enc_passwd);
				if ($passwd == $enc_passwd)
					$msg = '<font color=blue><b>YES It is that</b></font>';
				else
					$msg = '<font color=red><b>NO It is wrong</b></font>';
			}
			else
				echo "<b>Could not open encryption library file</b><br>\n";
		}
	}
	echo "<tr><td colspan=3 align=center>$msg</td></tr>\n";
}
?>
</form>