Location: PHPKode > projects > ERPSOD > erpsod/chgpwd.php


if(isset($_COOKIE['ID_my_site'])) {
	$username = $_COOKIE['ID_my_site']; 
	$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
	$info = mysql_fetch_array( $check );
} else{
	header('Location: login.php');

if ($form1=="chgpwd"){
	if ($action == "Cancel") {
		header('Location: copyright.php');
	} else{
		// this makes sure both passwords entered match
		if ($_POST['pass'] != $_POST['pass2']) {
			$error = 'Your passwords did not match. ';
		// here we encrypt the password and add slashes if needed
		if ($error==""){
			$_POST['pass'] = md5($_POST['pass']);
			if (!get_magic_quotes_gpc()) {
				$_POST['pass'] = addslashes($_POST['pass']);
			$id = $info['username'] ;
			$sql="UPDATE users SET password='$password' WHERE username = '$id'";
			$result = mysql_query($sql)or die($sql);
			header('Location: logout.php');
<link rel="stylesheet" type="text/css" href="<?PHP echo $style ?>">
<script language="JavaScript1.2" src="js/coolmenus4.js">
<body bgcolor="#ffffff">
<script language="JavaScript1.2" src="js/erpsod.js">
<h3>Change your password</h3>
if ($error <>""){
	echo $error ;
	echo "<br>";
<FORM ACTION="chgpwd.php?form=chgpwd" METHOD="POST">
<table border=0 cellpadding=4 cellspacing=0 bgcolor="AQUA"><tr><td>
<td><?php echo $info['username'] ?></td>
<input type="password" name="pass" maxlength="10">
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="10">

<td colspan=2 align="center">
<INPUT TYPE="SUBMIT" NAME="command" VALUE="Submit">
<INPUT TYPE="SUBMIT" NAME="command" VALUE="Cancel">
Return current item: ERPSOD