简体   繁体   English

跨保持连接保持身份验证

[英]Persisting Authentication Across keep-alive Connection

Currently on my website when a user is logged in, for every webpage request you have to go to the database and check their cookie to confirm who they are, doing this across keep-alive connections is a waste because that connection was already authenticated, how can I, using PHP and/or apache, persist authentication across a keep-alive connection? 当前在我的网站上,当用户登录时,对于每个网页请求,您都必须进入数据库并检查其cookie以确认他们是谁,因此通过保持活动连接进行此操作很浪费,因为该连接已通过身份验证使用PHP和/或Apache,我可以在保持连接状态下保持身份验证吗? Is it simply not possible? 根本不可能吗?

just check the cookie to enter the site with a connection to the database, 只需检查Cookie即可进入具有数据库连接的网站,

If the checking is ok: you create a session cookie with a unique encryption exemple 如果检查正常:您创建一个具有唯一加密示例的会话cookie

md5("NAME"."PASS".Time()))

you are using an SQL only once per session ;) 您在每个会话中仅使用一次SQL;)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM