.................................................................................................................................................
<?
include "chksession.php";
if ($oldpass=="" or $newpass=="" or $newpass2=="" or $newpass<>$newpass2) {
echo "<center><h3> Error.!! : กรุณากรอกข้อมูลให้ครบด้วยค่ะ</h3>"; exit();
}
include "connect_to_mysql.php";
$sql="select * from user where username='$sess_username' and password='$oldpass' ";
$result=mysql_db_query($dbname,$sql);
$num=mysql_num_rows($result);
if ($num<1) {
echo "<center><h3>Error.!! : ขออภัยค่ะ..รหัสผ่านเดิมไม่ถูกต้องค่ะ</h3>"; exit();
}
$sql="update user set password='$newpass' where username='$sess_username' ";
$result=mysql_db_query($dbname,$sql);