Php 引荐来源网址是否有效?

标签 php javascript html security apache

我需要知道我网站上某个页面的引荐服务器。

是否有任何安全的方法来检查用户从何处“来到”页面?

我尝试将其上传到我的服务器,但是当我将地址写入浏览器地址栏中的文件时,这根本不会输出任何内容:

    <?php echo $_SERVER['HTTP_REFERER']; ?>

我需要检查这个以便在页面上显示链接...

谢谢

最佳答案

Is there any safe method to check where the user "came" to the page FROM?

不是真的。与所有 HTTP header 一样,这可以很容易地修改。此外,浏览器也可以选择从不发送引荐来源网址。

$_SERVER['HTTP_REFERER']; 将在浏览器确实发送引荐来源网址时起作用,但无法验证它是否真实。

I tried uploading this to my server, but this wont output anything at all when I write the adress to the file in the browsers adress bar

在这种情况下,浏览器不会发送引荐来源网址,因为您不是来自任何地方。

关于Php 引荐来源网址是否有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3007927/

相关文章:

php - fatal error : Uncaught Error: Call to undefined function bcadd()

javascript - 在 PHP 中使用 anchor 标记的 href 传递 ID 时出错?

javascript - 使粗糙的 svg 路径变得更平滑

javascript - Github 风格的 Markdown - 带有空行的代码块不会呈现

jquery - 在 .delay() 中嵌入函数无法正常工作

php - 清除 php 查询的下拉选项

php - 电子商务 : how to display custom success notice message on Logout?

php - 使用 jquery 动态更改 javascript youtube 播放器的 href

javascript - 使用颜色矩阵添加色调效果

html - 半圆圈与 Css