ajax登录问题
我创建了登录页面,它将 ajax 请求发送到 php 页面以进行登录验证。 在该 php 页面上,我创建会话,并根据登录验证发送响应。 如果用户通过身份验证,我将其从发送ajax的java脚本重定向到主页。但在那个主页上我无法获取该会话对象...为什么?你能告诉我在主页上检索该会话的解决方案吗
i have created login page which sends ajax request to a php page for login verification.
On that php page i m creating session, and sending response as per login verification.
if user is authenticated i m redirecting it to home page from java script from where i send ajax. but on that homepage i cant get that session object... why? can u tell me solution to retrieve that session on home page
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我这样做的方式是否正确,但它对我有用(我希望我没有忘记任何事情):
这是我的login.php所做的:
?>
然后,当我访问另一个 php 文件时,它是这样开始的:
我进行的每个 ajax 调用都会检查结果是否告诉我用户未连接,如果没有连接,则返回到登录页面。
对于登录 ajax 调用,我有:
I am not sure I do it the right way, but it works for me this way (I hope I didn't forget anything):
Here's what my login.php does :
?>
Then when I access another php file, here's how it begins :
Every ajax call I make checks if the result tells me the user isn't connected, and returns to the login page if he isn't.
For the login ajax call, I have :