使用session_save_path()时访问的麻烦

时间:2013-01-10 09:42:29

标签: php session count limit

我遇到了一些麻烦,事实上我已经完成了一个代码,以便计算同时登录的会话数。因为我想限制simultany连接的数量。

所以我写了以下代码:

 <?php
  if ($d = opendir(session_save_path())) {
     $count = 0;
     $session_timeout = 3 * 600;
     while (false !== ( $file = readdir($d) )) {
        if ($file != '.' && $file != '..') {
          if (time() - fileatime(session_save_path() . '/' . $file) <            $session_timeout) {
             $count++;
               }
          }
        }
   }
if ($count > $societe['max_utilisateurs']) {
    $sql = "INSERT INTO `session` SET
    `temps` = now(),
    `login`='" . $_SESSION['login'] . "',
    `mouvement`='2'";
     mysql_query($sql) or die;
     session_unset();
     session_destroy();
     header('Location: ../');
     exit();
   };
    ?>

在第一行我做opendir(session_save_path()它会给我带来以下错误

警告:opendir(/ var / lib / php5):无法打开dir:第523行/mnt/getcash-trunk/GESTION/index.php中的权限被拒绝

我不明白它是从哪里来的,因为我在每个文件夹和文件上使用ubuntu和完全权限777在本地服务器上工作。

非常感谢Anykind的帮助

0 个答案:

没有答案
相关问题