为了账号安全,请及时绑定邮箱和手机立即绑定

注意:未定义变量:第 16 行 /Applications/XAMPP/xamppfiles

注意:未定义变量:第 16 行 /Applications/XAMPP/xamppfiles

PHP
森林海 2021-08-28 10:27:14
使用用户名登录应用程序时,不使用电子邮件,因此会抛出以下错误,反之亦然“注意:未定义索引:电子邮件在 /Applications/XAMPP/xamppfiles/htdocs/menthor/login.php 中的第 16 行”我试过将产生错误的行放在条件中,但这些努力证明是徒劳的 Login.php 文件(与错误相关的部分)// STEP 1. Receive data / info paassed to current fileif ((empty($_REQUEST['username']) || empty($_REQUEST['password'])) && (empty($_REQUEST['email']) || empty($_REQUEST['password']))) {    $return['status'] = '400';    $return['message'] = 'Missing requird information';    echo json_encode($return);    return;} // securing received info / data from hackers or injections$email = htmlentities($_REQUEST['email']);$username = htmlentities($_REQUEST['username']);$password = htmlentities($_REQUEST['password']);// STEP 2. Establish connection with the serverrequire('secure/access.php');$access = new access('localhost' , 'root', '' , 'menthor');$access->connect();// STEP 3. Check existence of the user. Try to fetch the user with the same email address// STEP 3. Check availability of the login/user information$username_aval = $access->selectUser_Username($username);$email_aval = $access->selectUser_Email($email);//$return = array();// user is foundif ($username_aval) {    // Get encrypted password and salt from the server for validation    $encryptedPassword = $username_aval['password'];    $salt = $username_aval['salt'];通过 Web 服务器登录时的当前结果Notice: Undefined index: email in /Applications/XAMPP/xamppfiles/htdocs/menthor/login.php on line 16{"status":"200","message":"Successfully Logged In","id":"44","username":"rondell","email":"rondell@gmail.com","fullName":"rondell","lastName":"","birthday":"","gender":"","cover":"","ava":"","bio":"","allow_follow":"1"}预期成绩{"status":"200","message":"Successfully Logged In","id":"44","username":"rondell","email":"rondell@gmail.com","fullName":"rondell","lastName":"","birthday":"","gender":"","cover":"","ava":"","bio":"","allow_follow":"1"}
查看完整描述

2 回答

?
吃鸡游戏

TA贡献1829条经验 获得超7个赞

事实证明,经过一番思考,解决方案非常简单......我只需要简单地创建两个 login.php 文件......一个专门用于使用用户名和密码登录的用户,另一个用于用户签名输入电子邮件和密码...干杯


查看完整回答
反对 回复 2021-08-28
?
江户川乱折腾

TA贡献1851条经验 获得超5个赞

使用电子邮件作为对象,或者您可以转储请求并查看发生了什么


查看完整回答
反对 回复 2021-08-28
  • 2 回答
  • 0 关注
  • 129 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信