dtpf76658 2011-02-11 01:23
浏览 41
已采纳

如何使用PHP会话使登录系统工作?

I am needing help with a somewhat simple task but I want to tackle this task so that it works on all browsers. My only problem is that I only have access to a Mac and no PC machines. So here is what I am needing to do:

I have a user area where people take quizzes. Some quizzes are longer than others and what is happening is that of a user completes the quiz quickly, the quiz is submitted and scored. However, if the user takes longer than 30 minutes to an hour for example, the quiz will not submit and it will kick the user back to my home page.

I am using PHP and SESSIONS for the users login data. I do not have any expiration date on my SESSIONS and I do not know why it is doing this. Do I need to switch to cookies? Or Can I add something to the SESSIONS to make so the user will NEVER be logged out until the click on the "Logout" link.

  • 写回答

2条回答 默认 最新

  • dongyuli0964 2011-02-11 01:46
    关注

    You can configure it on php.ini file, defining a global timeout for sessions.

    But, during application runtime, you can define it as a ini_set variable.

    Here, you can set a timeout of 90 minutes after last server request.

    ini_set('session.cache_expire',90);
    

    More about session ini, you can find here: http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime

    You can extend this time ever request. I don't know about disable session expiration.

    But, as alternative, you can enable some polling on server to signalize an user interaction. i.e., some examples are found here: jQuery - polling of a job queue and here http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/

    []'s,

    And Past

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?