1.首先修改plu s/diy. php 在 if($fieldinfo[1] == ‘textdata’){${$fieldinfo[0]} = FilterSearch(stripslashes(${$fieldinfo[0]}));${$fieldinfo[0]} = addslashes(${$fieldinfo[0]});} 后面添加if($fieldinfo[0] == ‘ip’){${$fieldinfo[0]}=GetIP();}i […]
1.首先修改plus/diy.php
在 if($fieldinfo[1] == ‘textdata’){${$fieldinfo[0]} = FilterSearch(stripslashes(${$fieldinfo[0]}));${$fieldinfo[0]} = addslashes(${$fieldinfo[0]});}
后面添加if($fieldinfo[0] == ‘ip’){${$fieldinfo[0]}=GetIP();}if($fieldinfo[0] == ‘time’){${$fieldinfo[0]}=date(“Y-m-d H:i:s”);}
if($fieldinfo[0] == ‘laiyuanyemian’)
{
${$fieldinfo[0]}=curPageURL();
}
2.在plus/diy.php上方添加以下代码,如果要获取来源地址的话
<?php
// 说明:获取完整URL
function curPageURL()
{
$pageURL = ‘http';
if ($_SERVER[“HTTPS”] == “on”)
{
$pageURL .= “s”;
}
$pageURL .= “://”;
if ($_SERVER[“SERVER_PORT”] != “80”)
{
$pageURL .= $_SERVER[“SERVER_NAME”] . “:” . $_SERVER[“SERVER_PORT”] . $_SERVER[“REQUEST_URI”];
}
else
{
$pageURL .= $_SERVER[“SERVER_NAME”] . $_SERVER[“REQUEST_URI”];
}
return $pageURL;
}
?>
在自定义字段里添加字段
IP地址:ip
提交时间:time
(字段名称一定要和diy.php添加的字段名一致)
在表单中调取
<input name=”ip” id=”ip” value=”” type=”hidden”><input name=”time” id=”time” value=”” type=”hidden”>
type=’hidden’ 为隐藏字段,在前端不显示,用户提交后台会自动获取IP和时间