我如何制作它,以便用户只能访问我网站上的某个HTML文件,如果他/她有某个cookie [英] How do I make it so a user can only access one of the HTML files on my website if he/she has a certain cookie

查看:73
本文介绍了我如何制作它,以便用户只能访问我网站上的某个HTML文件,如果他/她有某个cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法创建了一个登录表单,在用户登录时为其提供了一个cookie,但我需要一种方法来实现它,这样任何人都无法访问我的网络数据库的主要HTML,除非他们已登录



我尝试了什么:



到目前为止没什么,不知道该做什么

i've managed to make a login form which gives the user a cookie when they login, but i need a way to make it so nobody can access the main html of my web database unless they've logged in

What I have tried:

so far nothing, no idea what to do

推荐答案

使用会话变量而不是cookie。会话存储在客户端计算机上的cookie上,这样更安全吗?查看 PHP教程:检查用户是否已登录 [ ^ ]
Use a session variable instead of cookie. Session is stored on the server while cookie on the client machine, so which is more secured? Check out PHP Tutorials: Checking if the user is logged on[^]


这篇关于我如何制作它,以便用户只能访问我网站上的某个HTML文件,如果他/她有某个cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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