"Change Password application"
Hej CE,Jeg sidder med en "Change-Password-application", hvor jeg får fejlkoden
Notice: Undefined index: currentpass in /Applications/AMPPS/www/BuisnessWorld/Password_change.php on line 46
NULL array(0) { }
Koden er herunder:
<?php
session_start();
$con = new mysqli('****', '****, '****', '****');
$user=$_SESSION["user"];
if ($con->connect_errno) {
echo "Failed to connect to MySQL: (" . $con->connect_errno . ") " . $con->connect_error;
}
$stmt = $con->prepare("SELECT * FROM members WHERE user=? LIMIT 1");
$stmt->bind_param("s", $user);
// execute
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
if ($_POST["currentPass"] == $row["pass"] && $_POST["newPass"] == $row["confirmPass"]) {
$updateStmt = $con->prepare("UPDATE members SET pass=? WHERE user=?");
$stmt->bind_param("s", $user);
$updateStmt->bind_param("ss", $_POST["newpass"], $pass);
$updateStmt->execute();
$message = "Password changed successfully!";
} else {
$message = "Password is incorrect.";
}
}
ini_set('display_errors', 1);ini_set('display_startup_errors', 1);error_reporting(E_ALL);
var_dump($_POST["currentpass"]);
var_dump($_POST);
?>
Tak for hjælpen på forhånd,
Vh SSC