如何通过拒绝带有cookie的人来限制对网页的访问 [英] How do I restrict access to a web page by rejecting those with a cookie

查看:101
本文介绍了如何通过拒绝带有cookie的人来限制对网页的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好

我的名字是Marzena,我来自立陶宛。

我有一个问题 - 对我来说这是一个很大的问题,对你来说可能是一个笑话。

在php上完成noob我已经设法找到将cookie嵌入客户端浏览器并且运行良好的脚本。放置cookie的原因是我希望我的访问者只能访问我的一些网页,并且cookie应该作为服务器的指示器,不要让客户端再次浏览器。

我知道它使用cookie的不寻常方式,但这是我能想到的唯一方法,相对确定不会有任何混乱。在立陶宛,ISP仍然使用动态IP,并且需要某种基于设备的识别。

你们中的任何一个人都可以为我输入这几行代码,这样我就可以简单地限制以前的访问者(那些访问者)已经有了cookie)。

cookie将在他们同意的情况下放置,整个事情的原因如下:

我必须提供工作证明我的网站,但每组人都会有所不同,而且会改变很多次。我只是不希望别人看到不适合他们的工作证明,每个客户一次访问就足以下载文件了。我也会把这个东西通过电子邮件发送给感兴趣的人,但是,我不知道他们是谁(大多数情况下)。我没有从中获得任何东西,除非我受到某些大学社会的欢迎(全国范围内) - 工作证明与诗歌有关,与IT无关。

有没有人出来谁会准备让我去,我被困住了,谷歌显示没有任何结果。

感谢您提前任何帮助

Marzena



我尝试了什么:



我试图在谷歌上找到任何类似的问题没有结果......

我的想法一定很奇怪...... :)

Hi Guys
My name is Marzena and I'm from Lithuania.
I have a problem- to me it is a huge one, to you probably a joke.
Being complete noob at php I have managed to find the script to embed a cookie onto the client browser and its working well. The reason for the cookie to be placed is that I want my visitors to be able to visit some of my web pages only once, and the cookie should work as a indicator for the server not to let the client browser in again.
I know its unusual way to use cookies but this is the only way that I can think of to be relatively certain that there will be no mess. In lithuania the ISP's still use dynamic IP's , and some sort of device based identification is required.
Could any one of you type this few lines of code for me so I could simply restrict previous visitors (those who already have the cookie).
The cookie will be placed with their consent and the reason for the whole thing is as follows:
I have to present a proof of work on my website but it will be different for each group of people, and it will be changed quite a few times. I simply don't want others to see the proof of work not intended for them and one visit per client is enough to download the file. Also I would email the thing to interested parties but, well, I don't know who they are ( for most part). I'm not gaining anything from this except I would be welcomed to certain college society (country-wide)- the proof of work is poetry related and have nothing to do with IT.
Is there anybody out there who would be ready to get me going, I'm stuck and google shows no results whatsoever.
Thank you for any help in advance
Marzena

What I have tried:

I have tried to find any similar issue on google with no result...
My idea must be very weird... :)

推荐答案

PHP不难,学习它,有许多教你或甚至书籍的网站。

这是最容易介入的语言之一。



如果你想定制你的网站是你自己,这是你应该做的最低限度,不知道你运行/使用的是你自己的网络服务器和你的访客隐私/安全的风险。



To在这个问题上稍稍松懈,你需要的是一个简单的过滤器,例如;



带有id,ip和reason的mysql表
$ b $所有运行脚本的php文件中的ba标题,该脚本将
PHP isnt difficult, learn it, there are many websites that teaches you or even books.
It is one of the easiest languages to step into.

if you want to customize your website your self, this is the minimum what you should be able to do, being ignorant of what you run/use is a risk for your own webserver and your visitors privacy / security.

To give a little slack in the matter, what you need is a simple filter, for example;

mysql table with id, ip and reason
a header in all your php files that run a script that compares


_SERVER ['REMOTE_ADDR']与表中的ip行进行比较。例如:



_SERVER['REMOTE_ADDR'] with the ip row in your table. for example:


query = mysqli_query( 来自IP_BANS的选择原因WHERE ip =


这篇关于如何通过拒绝带有cookie的人来限制对网页的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆