0
I have the following code and the following error appears to me
<?php
$user=$_SESSION['MM_Username'];
if($user){
//user is logged in
if($_POST['submit']){
//start changing password
$oldpassword=md5($_POST['senha_atual']);
$newpassword=md5 ($_POST['senha_nova']);
$repeatnewpassword=md5 ($_POST['confirme_senha']);
//check password against db
//connect db
mysql_select_db($database_bvmarco, $bvmarco);
$query_password = sprintf("SELECT password FROM login WHERE numMec = '$user'");
$password = mysql_query($query_password, $bvmarco) or die(mysql_error());
$row_password = mysql_fetch_assoc($password);
$totalRows_password = mysql_num_rows($password);
$oldpassworddb=$row_password['password'];
//check password
if($oldpassword==$oldpassworddb){
//chek new passwords
if($newpassword==$repeatnewpassword){
//success
//change password in db
$querychange = mysql_query("UPDATE login SET password='$newpassword' WHERE numMec = '$user'");
session_destroy();
die("Password alterada com sucesso!");
}else{
die("As password's não são iguais");
}
}else{
die("A password atual não bate certo");
}
}else{
echo"<div class='card-body'>
<form METHOD='POST' name='password'>
<div class='align-items-center justify-content-center'>
<div class='form-group'>
<label><b>Antiga password</b></label>
<input type='text' placeholder='Antiga password' name='senha_atual' class='form-control'>
</div>
<div class='form-group'>
<label for='tipo'><b>Nova password</b></label>
<input type='text' placeholder='Nova password' name='senha_nova' class='form-control''>
<label for='tipo'><b>Confirme password</b></label>
<input type='text' placeholder='Nova password' name='confirme_senha' class='form-control'>
</div>
<input type='submit' name='submit' id='submt' value='Change password'>
</div>
</form>
</div>";
}
}else{
die("Precisas fazer o login para mudar a password!");
}
?>
He’s still giving the same news
– Adelino Vasconcelos
Notice: Undefined index: Submit in D: wamp64 www bvmarco password.php on line 201
– Adelino Vasconcelos
if(isset($_POST['Ubmit'])){
– Adelino Vasconcelos
I before testing on the page write always and I already cleaned the browser cache but it appears in the same
– Adelino Vasconcelos
How can I do then not to get the news
– Adelino Vasconcelos
I just changed the code, and I recorded it again and it keeps coming up, I’ll add the code to the top and new image,
– Adelino Vasconcelos
I hadn’t noticed, sorry and thanks for your help
– Adelino Vasconcelos