File: changepassword.php

package info (click to toggle)
cacti 0.6.7-2.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,000 kB
  • ctags: 1,120
  • sloc: php: 5,059; sql: 922; sh: 302; perl: 81; makefile: 56
file content (78 lines) | stat: -rw-r--r-- 2,820 bytes parent folder | download
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
<?/* 
+-------------------------------------------------------------------------+
| raXnet Authentication Scripts                                           |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any        |
| questions or comments regarding this code should be directed to:        |
| - iberry@raxnet.net                                                     |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/                                       |
+-------------------------------------------------------------------------+
*/?>
<? 	$current_path = dirname(__FILE__);
	include ("$current_path/config.php");
	include ("$current_path/database.php");
	
	$userid = $HTTP_COOKIE_VARS[$conf_cookiename];
	$res_id_user = mysql_query("select * from auth_users where id=$userid",$cnn_id);
	
	$ip = trim(getenv("REMOTE_ADDR"));
	$username = mysql_result($res_id_user, 0, "username");
	
	switch ($action) {
		case 'changepassword':
			if (($password == $confirm) && ($password != "")) {
				mysql_query("insert into auth_log (username,success,ip) values(\"$username\",3,\"$ip\")",$cnn_id);
				mysql_query("update auth_users set mustchangepassword=\"\",password=PASSWORD(\"$password\") where id=$userid",$cnn_id);
				
				header ("Set-Cookie: changepassword=0; path=/;");
				header("Location: $ref");
				exit;
			}else{
				$badpassword = true;
			}
			
			break;
	} ?>
<html>
<head>
	<title>Login to <?print $conf_realm_name;?></title>
	<link href="<?print "$conf_web_path/..";?>/css/main.css" rel="stylesheet">
</head>
<body>
<form method="post" action="<?print "$conf_web_path/";?>changepassword.php">
<table align="center">
	<tr>
		<td colspan="2"><img src="<?print "$conf_web_path/..";?>/images/login.gif" border="0" alt=""></td>
	</tr>
	<?if ($badpassword == true) {?>
	<tr height="10"></tr>
	<tr>
		<td colspan="2"><font color="#FF0000"><strong>Your passwords do not match, please retype:</strong></font></td>
	</tr><?}?>
	<tr height="10"></tr>
	<tr>
		<td colspan="2">
			<strong><font color="#FF0000">*** Forced Password Change ***</font></strong><br><br>
			Please enter a new password for <?print $conf_realm_name;?>:
		</td>
	</tr>
	<tr height="10"></tr>
	<tr>
		<td>Password:</td>
		<td><input type="password" name="password" size="40"></td>
	</tr>
	<tr>
		<td>Confirm:</td>
		<td><input type="password" name="confirm" size="40"></td>
	</tr>
	<tr height="10"></tr>
	<tr>
		<td><input type="submit" value="Save"></td>
	</tr>
</table>
<input type="hidden" name="action" value="changepassword">
<input type="hidden" name="ref" value="<?print $ref;?>">
</form>
</body>
</html>