简体   繁体   English

我想通过 php 手动编写 url 来防止用户在我的网页中移动

[英]i want to prevent user from shifting in my web by writing url manually by php

我有主页并形成这个页面有一些按钮“每个按钮都会在点击后将用户引向正确的页面”我想使用 PHP 来防止用户手动编写 URL 我也使用了$_SERVER['HTTP_REFERER']但它不适用于所有浏览器。

You can try to achieve it in this way:您可以尝试通过以下方式实现它:

  • on every page looking for some $_POST value, for example if (isset($_POST['refer']))在每个页面上寻找一些 $_POST 值,例如if (isset($_POST['refer']))
  • if isset the value that you're looking for print the page content, otherwise print error, redirect to homepage or do what you want to do when the user come in the page without clicking on your button如果设置了您要查找的值打印页面内容,否则打印错误,重定向到主页或在用户进入页面时执行您想做的事情而无需单击您的按钮
  • modify your button, on click not only redirect the user but submit a form with the wanted post value修改您的按钮,单击时不仅会重定向用户,还会提交带有所需帖子值的表单

You can add your value directly into button value您可以将您的值直接添加到按钮值中

<form action="/yourpage.php" method="post">
  <button name="subject" type="submit" value="VALUE_TO_SEND">BUTTON 
TEXT</button>
</form>

VALUE_TO_SEND can be: the current url, or what you want to use to check the refer VALUE_TO_SEND可以是:当前的url,或者你想用什么来检查引用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止用户通过写入 URL 访问联系人 php 页面? - How to prevent a user from accessing contact php page by writing URL? 当我键入URL home.php时,它将打开,除非用户登录,否则我想阻止此操作 - when i type in the url home.php it opens, i want to prevent this action except if the user logged in 如何防止用户通过写入 URL 直接访问我的 html 页面? - How to prevent a user from directly accessing my html page by writing URL? 我想防止人们使用.htaccess直接访问我的php页面 - I want to prevent people from accessing my php pages directly using .htaccess 我想在我的 PHP 代码中添加一些东西以防止用户名重复 - I want to add to my PHP code something to prevent username duplication 如何防止用户手动进入网址,要求他们单击链接才能到达该网址 - How to prevent the user from manually going to the url, requiring that they click a link to get there 如果要在我的网站上使用facebook javascript或php sdk作为用户身份验证系统,是否需要https url - Do I need https url if I want to use facebook javascript or php sdk as user authentication system on my site php正在改变我的图像 - php is shifting my images 我想将我的joomla URL转换为用户友好的URL - I want to convert my joomla URL into user friendly URLs 我不要URL php中的lan = AL代码吗? - I Don't want ?lan=AL code in my url php?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM