如何为用户添加信息,如ip,发送时间(按埃及时间等国家/地区),浏览器,分辨率,访客来自
这是我的php文件
<?php
$webmaster_mail = 'sales@elfnoon.com';
$redirect_page = 'http://www.elfnoon.com/';
$message_subject = 'رسالة من زائر لموقعك';
$in_Body ='';
foreach($_POST as $in_k=>$in_v)
{
$in_Body .="$in_k = $in_v\n\n";
}
mail(trim($webmaster_mail), "$message_subject ", "$in_Body","From: " . trim($webmaster_mail));
header("Location: $redirect_page");
?>
和这个表格
<form action="form.php" method="post">
<input name="" type="text" value="اسمك الكريم" onblur="if (this.value=='')this.value='اسمك الكريم'" onclick="value=''" />
<br />
<input name="email" type="text" value="البريد الالكتروني" />
<br />
<input name="phone" type="text" value="رقم الهاتف" onblur="if (this.value=='')this.value='رقم الهاتف'" onclick="value=''" />
<br />
<textarea name="msg" cols="41" rows="5" placeholder="نص الرساله" wrap=soft></textarea>
<br />
<input type="submit" value="ارسال" />
</form>
答案 0 :(得分:0)
有关IP和浏览器的信息,您可以检查$_SERVER['REMOTE_ADDR']
和$_SERVER['USER_AGENT']
(请参阅var_dump($ _ SERVER)到所有可用条目。)
您可以使用以下方式获取时区指示时间:date('Y-m-d e');
如果您正在运行PHP5.1 +(http://www.php.net/manual/pt_BR/function.date.php),则“e”将显示时区
修改强>
<?php
$webmaster_mail = 'sales@elfnoon.com';
$redirect_page = 'elfnoon.com/';
$message_subject = 'رسالة من زائر لموقعك';
$in_Body ='';
foreach($_POST as $in_k=>$in_v) {
$in_Body .="$in_k = $in_v\n\n";
}
$in_Body .= 'The sender IP: ' . $_SERVER['REMOTE_ADDR'];
$in_Body .= 'The sender Browser: ' . $_SERVER['USER_AGENT'];
mail(trim($webmaster_mail), "$message_subject ", "$in_Body","From: " . trim($webmaster_mail));
header("Location: $redirect_page");
?>