提交表格时会失去会话 [英] SESSION lost when submitting form

查看:82
本文介绍了提交表格时会失去会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我一直在测试我的网站并遇到了问题,我有一个页面,其中成员可以制作一个组合,让其他成员能够评价它,推荐它,喜欢它等。


我的所有页面都有相同的结构,所有页面都包含相同的文件,例如session.php等。会话工作正常,直到它们提交表单时,表单提交后会将其记录下来,并且由于客人无法使用这些功能,因此会向他们显示一条消息,说明他们需要一个帐户来执行此操作。


我'我不确定从哪里开始寻找这个,我会发布一个我的代码示例,但我不知道发布什么,不能真正发布整个事情。如果有人需要我发布任何特定内容,我会很高兴。


谢谢,

Jeigh

Hello,

I''ve been testing my site and have ran into a problem, I have a page in which members can make a portfolio, giving other members the ability to rate it, recommend it, favourite it etc.

All my pages the pages have the same structure, all include the same files such as session.php etc. The session works fine until they submit a form, when the form is submitted it logs them out, and as guests can not use these functions it shows them a message saying they need an account to do this.

I''m not exactly sure where to start looking for this, I''d post an example of my code but I don''t know what to post and can''t really post the whole thing. If anybody needs me to post anything specific up I''ll be happy to.

Thanks,
Jeigh

推荐答案

如果会话在其他地方工作,很可能你只是忽略了表单流程代码中的某些内容。


你是否使用函数 session_unset()?

你可以尝试在你的代码中搜索会话这个词的所有实例,看看是否有东西不应该存在。
If the sessions are working everywhere else, it is most likely that you simply overlooked something somewhere in your form process code.

Do you use the function session_unset() anywhere in you code?

You could try searching for all instances of the word ''session'' in you code and see if there is something that shouldn''t be there.


Heya,Jeigh。


尝试将其添加到每个页面的顶部:
Heya, Jeigh.

Try adding this to the top of each page:
展开 | 选择 | Wrap | 行号


对于迟到的回复感到抱歉,我使用了它并且每次都显示正确页面除了我在个人资料页面上提交了一个表单之后,也就是它将我注销以便会话丢失。绝对没有什么我可以看到会摆脱会话,形式是非常基本的。所以稍微混淆了这个:P
Sorry for the late reply, I used that and it showed up properly on every page except after I submitted a form on the profile page, which is when it logged me out so the session was lost. There''s absolutely nothing that I can see that would get rid of the session, the form is very basic. So slightly confused on this one :P


这篇关于提交表格时会失去会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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