doucheng7808 2018-08-12 21:29
浏览 63

PHP会话仅针对某些用户和设备丢失

I have a PHP website that requires users to be registered and logged in. I use PHP sessions to manage the information from logged in users. It has been working great until few months back but I am now having issues with certain users and devices only.

The user starts in index.php with the login form. When submitted, there is a control.php page that controls whether the user is registered and gives or denies control. If the user is registered, it goes to menu.php.

Now, the problem is that some users, despite entering the right login info, are unable to reach menu.php in their Android devices using Chrome (even if they are able to do it in a PC, also using Chrome, or in other devices).

I debugged the session variables and realized that they are fully killed when redirecting from control.php to menu.php. However, as this is only happening to some users in some devices, I understand there is no issue with redirects or others that I read in similar posts.

I also saw other cases where the recommendation was to clear cookies and cache in Chrome. I tried with that too and it did not work. The session_id() changes after clearing all information but info is still killed.

After reseraching for weeks and trying every possible solution, I am now completely lost. Any recommendations would be more than welcomed.

By the way, I am running nginx and PHP 5.5.9

Thank you in advance,

JR

control.php looks like

$nick=$_POST['nick'];
$pass=md5($_POST['pass']);
$q=mysql_fetch_array(mysql_query("select * from ft_managers where (nickmanager='$nick' or email='$nick') and (passmanager='$pass')"));

if($q['activado']==1) // Means account is activated
{
session_start();
$_SESSION['permiso']=1;
$_SESSION['nick']=$q['nickmanager'];
$_SESSION['username']=$q['nickmanager'];
$_SESSION['id']=$q['idmanager'];
Header("Location: menu.php");
exit

}
else
{
    Header("Location: index.php?error=1");
}
?>

menu.php looks like

<?php
session_start();
print_r($_SESSION);
echo session_id();
// Rest of the code here, but the print_r already shows no info for certain users and devices. For the same user in a different device, everything works
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!