<?php
include("db_conection.php");
if(isset($_POST['ForgotSubmit']))
{
session_start();
echo $admin_name=$_POST['admin_name'];
$pass_identity=$_POST['pass_identity'];
$admin_query="select * from admin where admin_name='$admin_name' AND pass_identity='$pass_identity'";
$$sql = "UPDATE admin SET admin_pass='password' WHERE admin_name = '$admin_name'";
$run_query=mysqli_query($dbcon,$admin_query);
if(mysqli_num_rows($run_query)>0)
{
if($admin_name == "admin"){
echo "<script>alert('Your password is now set to *password*.'); window.location='Admin-Secu-Login.php'</script>";}
if($admin_name == "security"){
echo "<script>alert('Your password is now set to *password*'); window.location='Secy-Account-Details.php'</script>";}
}
else {echo"<script>alert('Does not match.')</script>";}
}
?>
我想将密码重置为默认密码。我需要做的第一件事就是正确回答安全问题,但是当我点击按钮时,它在我的数据库中不会改变请帮助
答案 0 :(得分:-1)
这一行:$$sql = "UPDATE admin SET admin_pass='password' WHERE admin_name = '$admin_name'";
(=&gt; $ sql)你还没有用过这个命令
...
if($admin_name == "admin"){
$run_query=mysqli_query($dbcon,$sql); //add this line
echo "<script>alert('Your password is now set to *password*.'); window.location='Admin-Secu-Login.php'</script>";}