如何使用 php 将密码重置为默认密码
how to reset password into default using php
<?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>";}
}
?>
我想将我的密码重置为默认密码。我需要做的第一件事是正确回答安全问题但是当我点击按钮时它在我的数据库中没有改变请帮助
这一行:$$sql = "UPDATE admin SET admin_pass='password' WHERE admin_name = '$admin_name'";
(=> $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>";}
<?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>";}
}
?>
我想将我的密码重置为默认密码。我需要做的第一件事是正确回答安全问题但是当我点击按钮时它在我的数据库中没有改变请帮助
这一行:$$sql = "UPDATE admin SET admin_pass='password' WHERE admin_name = '$admin_name'";
(=> $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>";}