gpt4 book ai didi

javascript - _POST不抓取数据

转载 作者:行者123 更新时间:2023-12-02 22:51:20 25 4
gpt4 key购买 nike

我正在开发登录系统,但在帖子论坛方面遇到问题。这是我所拥有的,我觉得我已经尝试了几乎所有的方法,但没有运气。

我尝试重命名这些名称,并回显信息。用户名工作正常,这是我遇到问题的隐藏密码。

    <script>
function changeFormLogin() {
var pass = document.getElementById('getPass').value;
var username = document.getElementById('username').value;
var getSalt = <?php echo $salt ?>;
var hashpass = sha256(getSalt+pass);

document.getElementById("hiddenPass").value = hashpass;
document.getElementById("hiddensalt").value = getSalt;
}
</script>

<h2>Sign Up Here</h2>
<form onsubmit="changeFormLogin()" action="tryLogin.php" METHOD="POST">
<p>Email</p>
<input id="username" type="email" name="username" placeholder="Enter Email" value = "<?php echo $username ?>" required>
<p>Password</p>
<input id="getPass" type="password" name="password" placeholder="••••••" required>
<!-- Add two hidden fields right here -->
<input id="hiddenPass" type="hidden" name="hiddenPass1" value="">
<input id="hiddensalt" type="hidden" name="hiddensalt" value="">
<input type="submit" name="login" value="Sign In">
</form>

这是 PHP 文件:

   <?php
include_once('connect.php');


$username = $_POST['username'];
$password = $_POST['hiddenPass1'];
$salt = $_POST['hiddensalt'];
$userid = "";
$valid = "";

最佳答案

您缺少在 changeFormLogin 函数中发送表单以提交表单,不要忘记将 id 添加到您的表单

document.getElementById("yourFormId").submit();

关于javascript - _POST不抓取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58177381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com