douxianxing5712 2019-01-13 18:15
浏览 55

PHP在获取编辑ID时包含链接不起作用

first time posting here, but need help as I am quite new to PHP, and I've searched but couldn't find a similar question.

My index file has this php include:

include($_GET['underside']);

On one of my other pages (opret.php) I've created a CRUD and everything works. However when I try to fetch the data from a given ID, in to my inputs, the link won't work with the include.

The link is as following:

<a href="opret.php?rediger=<?php echo $row['TilbudId']; ?>" class="btn btn-info">Rediger</a>

Which ends up being this in the browser:

http://localhost:8080/StampIT/index.php?underside=opret.php?rediger=7

I know this seems a bit far out, but I don't know if theres a way around it. I am getting these errors:

Warning: include(opret.php?rediger=7): failed to open stream: No such file or directory in D:\wamp64\www\StampIT\index.php on line 56

And

Warning: include(): Failed opening 'opret.php?rediger=7' for inclusion (include_path='.;C:\php\pear') in D:\wamp64\www\StampIT\index.php on line 56

I can make it work if I just forget about includes and make separate pages for everything, however I would really like to avoid that.

I hope someone can help, and that it was somewhat understandable. Thanks!

  • 写回答

1条回答 默认 最新

  • douya1061 2019-01-13 18:28
    关注

    http://localhost:8080/StampIT/index.php?underside=opret.php?rediger=7

    You have to seperate GET parameters with a & sign. It has to be

    http://localhost:8080/StampIT/index.php?underside=opret.php&rediger=7

    Besides: The include looks like a potential file inclusion vulnerability. An attacker could manipulate that parameter and include a file (or probably even remote script) that is not supposed to be processed by your site. For example index.php?underside=/etc/passwd

    评论

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助