织梦dede自定义表单自动获取IP地址和提交时间

2025-05-24 20:12:50

1、第一步:在根目录中找到plus/diy.php文件,然后查找下面的代码  if($fiel蟠校盯昂dinfo[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");  }添加完后代码如下图:

织梦dede自定义表单自动获取IP地址和提交时间织梦dede自定义表单自动获取IP地址和提交时间

3、第三步:修改前端html页面找到你网站提交信息页面的模板文件,然后查找下面的代码:<input type="hidden" name="dede_fields"如图:

织梦dede自定义表单自动获取IP地址和提交时间

5、第五步:给第三步中找到的代码添加信息:ip,text;time,text例如:<input type="hidde荏鱿胫协n" name="dede_fields" value="city,select;area,text;shi,select;ting,select;chu,select;wei,select;yangtai,select;xm,text;tel,text;dizhi,text;fengge,text" />添加后(加粗的代码就是需要添加的代码):<input type="hidden" name="dede_fields" value="city,select;area,text;shi,select;ting,select;chu,select;wei,select;yangtai,select;xm,text;tel,text;dizhi,text;fengge,text;ip,text;time,text" />

织梦dede自定义表单自动获取IP地址和提交时间

6、最后提醒大家,如果您在修改以后发现提示:“数据校验不对,程序返回”,请点击下面链接

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢