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

 时间:2026-02-15 10:14:38

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");

  }

添加完后代码如下图:

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

2、第二步:后台添加对应字段(也就是要抓取的IP和time字段)

网站后台找到自定义表单---->编辑---->添加字段

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

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

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

3、第三步:修改前端html页面

找到你网站提交信息页面的模板文件,然后查找下面的代码:

<input type="hidden" name="dede_fields"

如图:

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

4、第四步:在第三步找到的代码前面添加下面的信息:

(重要提示:第二步添加的字段要跟下面中的name相互对应)

<input type="hidden" name="ip" id="ip" value="">

<input type="hidden" name="time" id="time" value="">

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

5、第五步:给第三步中找到的代码添加信息:ip,text;time,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" />

添加后(加粗的代码就是需要添加的代码):

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

  • 备案网站迁移这样弄会被判定为空壳网站
  • 棋牌游戏平台开发:棋牌运营如何做好推广?
  • 锅炉热电机组DEH操作说明?
  • ZEQ丰臀打造诱惑美臀翘臀法
  • 篮球比赛还可以在直播(8)吧 里看的
  • 热门搜索
    莫名其妙的近义词 电脑热点怎么开 鼻窦炎怎么治疗最好 慢条斯理的近义词 群策群力的近义词 怎么才能瘦下来 浙江自然博物馆 舌头烫伤怎么办 踌躇的近义词 急促的近义词