我收到一封电子邮件来重置我的密码,但每当我点击链接时,它应该转到我的"change_password.php",但它直接转到我的"index.php",这使得用户无法更改或重置他们的密码密码.
我的链接包含id和code我设置,并且每当发送电子邮件时数据库中的代码都会更新,但它是不起作用的链接.
这就是我的链接:
mywebsite.com/change_password.php?user_id=29&key=233602
但是当我点击它时,它应该引导我到这个页面,我的change_password.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include 'lib/password.php';
$db = new mysqli('localhost', 'user', 'pass', 'db');
if($_GET['user_id']!="" && $_GET['key']!=""):
$id=mysqli_real_escape_string(trim($db,$_GET['user_id']));
$code=mysqli_real_escape_string(trim($db,$_GET['key']));
$fetch=$db->query("SELECT * FROM `profile` WHERE id='$id' AND `code` = '$code'");
$count=mysqli_num_rows($fetch);
if($count!=1) :
header("Location:index.php");
endif;
else :
header("Location:index.php");
endif;
?>
<?php include 'home-header.php'; ?>
</head>
<body>
<?php include 'home-navbar.php'; ?>
<div class="modal-dialog">
<h2>Forgot Password Recovery</h2>
<div class="modal-content col-md-8">
<div class="modal-header">
<h4 class="modal-title"><i class="icon-paragraph-justify2"></i> Change New Password</h4>
</div>
<form method="post" autocomplete="off" id="password_form">
<div class="modal-body …Run Code Online (Sandbox Code Playgroud) php ×1