dongpiansui8755 2015-10-22 20:12
浏览 8

覆盖具有临时登录字段的网页

I have a heavy ajax based web application. A single PHP file, codro.php is being loaded when the user logs in. All the rest on webpage is ajax based (buttons, navigation bar and so on).

After 30 minutes of inactivity the system will log the user out. If the user logs in the system again, he/she must navigate the certain working area in the application. So the user must repeat every step again.

Is it possible to create a cover of the webpage with login fields, so that when the user logs in the system, the cover just disappears and the user continues working at the same place where he/she was before logout?

Are there any other solutions for that issue? and what about security?

  • 写回答

1条回答 默认 最新

  • douangzhao4108 2015-10-22 20:32
    关注

    Without any code it's hard to get a clear idea of how your code is running. I'm assuming you're using a session variable to determine whether the user is logged in or not.

    The truth is that sessions close after a particular duration of being inactive. With that said you can increase the session duration. This may prove useful

    Another option is you could send a cookie to let the client hold on to; however this isn't as secure as session.

    If you want to approach the method you were asking about, you could set the page they were trying to navigate to using $_SERVER['REQUEST_URI'] and store it as a variable then navigate using header('Location: myLoginPage.php?oldURL=$oldURL')

    So in the php file that's called be the AJAX would look something like this:

    <?php
    //Some other authenication code
    if( !isset($_SESSION['userID']) ) {
        $oldURL = $_SERVER['REQUEST_URI'];
        header('Location: myLoginPage.php?oldURL=$oldURL');
        die; //stop running code
    }
    //Other code and functions
    ?>
    

    Let me know if this helps!

    评论

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法