Location: PHPKode > projects > ProPHP > ProPHP/content/public/profile.php
<?php
/*****************************************************************
************* BKWORKS PRO PHP V 0.5 BETA 1 ***********************
******************** BRYAN KOOIENGA ******************************
****************** DECEMBER 20, 2007 *****************************
*****************************************************************/
if(!defined("INDEX")) {
	header("location: ../../?view=home");
}
if($username != "") { // If statement 1
	if(! $_POST) { // If statement 2
		$show = 1;
	} /* else 2 */ else {
		$old_pw = $_POST['old_pass'];
		$query = "SELECT * FROM sites WHERE site_url = '$username' AND password = '" . md5($old_pw) . "'";
		$query = mysql_query($query) or die("Can't query because " . mysql_error());
		$num_rows = mysql_num_rows($query);
		if($num_rows != 0) { // If statement 3
			$new_pw = $_POST['new_pass'];
			$confirm = $_POST['confirm'];
			if($new_pw == $confirm AND $new_pw != "") { // if statement 4
				$query = "UPDATE sites SET password = '" . md5($new_pw) . "' WHERE site_url = '$username' LIMIT 1";
				mysql_query($query) or die("Can't query because " . mysql_error());
				echo "<h3 align=\"center\">Password changed successfully!</h3>";
				$show = 0;
			} /* else 4 */ else {
				$error = "The passwords don't match, or they were blank.";
				$show = 1;
			} // end if 4
		} /* else 3 */ else {
			$error = "Invalid current password.";
			$show = 1;
		} // end if 3
	} // end if 2
		$show = 1;
} /* else 1 */ else {
	include("content/homepage/index.php");
} // end if 1
if($show == 1) {
?>
<center>
<form action="" method="post">
<h3>Password Change</h3>
To change your password, please enter your current password and change below.<br />
<?php if($error) echo "<b><font color=\"red\">$error</font></b><br>"; ?>
Current Password:<br />
<input type="password" name="old_pass" /><br />
New Password:<br />
<input type="password" name="new_pass" /><br />
New Password (Confirm):<br />
<input type="password" name="confirm" /><br />
<input type="submit" value="Change Password" />
</form>
</center>
<?php
}
?>
Return current item: ProPHP