我正在尝试创建一个忘记密码页面.我听说通过电子邮件将原始密码发送给用户并不是一个好主意所以我试图创建一个随机确认密码,他们可以用来登录他们的帐户,然后将密码更改为他们想要的任何密码.到目前为止,问题是它说用户的电子邮件实际上并不在数据库中.另外,我应该更新数据库以存储随机密码还是我的工作方式?我的数据库有表用户名,fristname,电子邮件和密码.我要求用户以html格式发送电子邮件地址,然后将其发送到此php表单.这是我第一次尝试这样做,因此它可能会有很多错误,但我找到了一个教程来帮助一些,所以它不应该.谢谢您的帮助.
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sending Password</title>
</head>
<body>
<?php
$db_server = "server";
$db_username = "name";
$db_password = "pass";
$con = mysql_connect($db_server, $db_username, $db_password);if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$database = "Test_Members";
$er = mysql_select_db($db_username);
if (!$er)
{
print ("Error - Could not select the database");
exit;
}
//include "session.php";
function createRandomPassword() {
$chars = …Run Code Online (Sandbox Code Playgroud)