Okay, I have it working, but atm anyone can change anyone's password.
Here's my form:
<form action="changepass.php" method="post">
<font color="#FFFFFF" size="1">
<input type="text" name="id" value="Username"/>
<b><input type="text" name="oldpassword" value="Current Password"/></font></b>
<input type="text" name="newpassword" value="New Password"/></font></b>
<b><input type="text" name="connewpassword" value="Confirm New"/></font></b>
<input type="submit" value="submit"/></font></b>
</form>
Changepass.php:
?php
$con = mysql_connect("*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("*", $con);
$sql="UPDATE users SET `password` = '$_POST[password]' WHERE `username` = '$_POST[id]'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<font color='#FFFFFF' size='2'>1 record updated</font>";
mysql_close($con)
?>
How would I make it check the username and current password are correct, if they are, change it to the new password (which has to be confirmed with both fields) or die if anything is wrong.
Thanks in advance
~Karl