'.mysqli_error($db)); } mysqli_select_db($db, $mysql_database) or die('Failed to select database
'.mysqli_error($db)); mysqli_set_charset($db, 'utf8'); $sql = "SELECT password FROM ".$mysql_table." WHERE username = '".mysqli_real_escape_string($db, $username_value)."'"; $result = mysqli_query($db, $sql); if ($data = mysqli_fetch_array($result)) { if ($password_value == $data['password']) { $sql = "UPDATE `".$mysql_table."` SET `password` = '$newpassword' WHERE `username` = '$username_value'"; mysqli_query($db, $sql); } else { $error_message = 'Old password is not valid!'; } } mysqli_close($db); if (empty($error_message)) { header('Location: '.$success_page); exit; } } } } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'logoutform') { if (session_id() == "") { session_start(); } unset($_SESSION['username']); unset($_SESSION['fullname']); header('Location: ./login.php'); exit; } ?> userchangepassword
Change your password