Просмотр файла session/fec667cf5eab81a3ff8eae6595a4b4d4fec667cf5eab81a3ff8eae6595a4b4d4/index.php

Размер файла: 6.02Kb
<?
if (!strpos($_SERVER['SCRIPT_NAME'],substr(session_id(),(strlen(session_id())/2),strlen(session_id())).session_id().substr(session_id(),0,(strlen(session_id())/2)).'/index.php'))
    {
     header('location: http://'.$_SERVER['SERVER_NAME'].'/'); exit();
    }
require_once('/home/wapmoto/www/conf.php');
#require_once('/home/users/w/wapmoto/docs/chat/conf.php');
db_connect();
if ($_SERVER['SERVER_NAME'] == server)
    {
     $cls = new chat;
     if (session_is_registered('nick') && session_is_registered('pass') && session_is_registered('visit')
     && session_is_registered('user_agent') && session_is_registered('ip') && is_dir(rootpath.'session/'.substr(session_id(),(strlen(session_id())/2),strlen(session_id())).session_id().substr(session_id(),0,(strlen(session_id())/2)))
     && mysql_fetch_object(mysql_query('SELECT `online` FROM `chat_session` WHERE `session` = "'.substr(session_id(),(strlen(session_id())/2),strlen(session_id())).session_id().substr(session_id(),0,(strlen(session_id())/2)).'"'.
                                       ' AND `login` = "'.$_SESSION['nick'].'"')) && isset($_GET['6a9f58']))
     {
      if ($idu = mysql_fetch_object(mysql_query('SELECT * FROM `'.$px.$utable.'` WHERE `login` = "'.$_SESSION['nick'].'" AND `pass` = "'.$_SESSION['pass'].'" LIMIT 1')))
          {
      $id = $idu->id; $time_update = $idu->tupdate;
      $login = $_SESSION['nick']; $pass = $_SESSION['pass'];
      $timev = $_SESSION['visit']; $soft = $_SESSION['user_agent'];
      $ip = $_SESSION['ip'];
      if ($soft != trim(substr(addslashes(htmlspecialchars($_SERVER['HTTP_USER_AGENT'])),0,65)))
          {
           header('location: '.rootlink.'?bad_browser');
           exit();
          }
      $mymsg = '<b><u>'.$login.'</u></b> входит в чат.';
      if (!session_is_registered('autentification'))
          {
           mysql_query('INSERT INTO `'.$px.$mtable.'` values(0,"System","'.$mymsg.'","","","'.time().'","all")');
           mysql_query('UPDATE `'.$px.$utable.'` SET `ip` = "'.$ip.'", `soft` = "'.$soft.'" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');
           $_SESSION['autentification'] = $mymsg; session_register('autentification');
          }
           mysql_query('UPDATE `chat_session` SET `timeout` = "'.time().'" WHERE `login` = "'.$login.'"');
           $status = $idu->status;
           $posts = $idu->posts;
           if (empty($status)){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Прохожий" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 100 && $posts < 500 && $status == "Прохожий"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Новичок" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 500 && $posts < 1000 && $status == "Новичок"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Пользователь" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 1000 && $posts < 3000 && $status == "Пользователь"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Продвинутый" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 3000 && $posts < 5000 && $status == "Продвинутый"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Чаттер" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 5000 && $posts < 7000 && $status == "Чаттер"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Тусовщик" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           if ($posts >= 7000 && $status == "Тусовщик"){mysql_query('UPDATE `'.$px.$utable.'` SET `status` = "Почетный" WHERE `id` = "'.$id.'" AND `login` = "'.$login.'"');}
           $qveri = explode('&',$_SERVER['QUERY_STRING']);
      $qveri = explode('/',$qveri['0']);
      $target = $qveri;
      #ob_start();
      if (!session_is_registered('dtime'))
          {
           session_register('dtime');
           session_register('tmt');
           $dtime = 0;
           $tmt = time();
          }
           else
               {
                $dtime = time()-$tmt;
                if ($dtime >= 60)
                    {
                     if ($dtime >= 3600)
                         {
                          $dhour = ($dtime/3600);
                          $dhmin = ($dtime%3600);
                         }
                     else
                         {
                          $dhour = '0'; $dhmin = 0;
                         }
                     $mins = ($dtime/60);
                     if ($mins < 60) {$dmin = $mins;}
                     else {$dmin = (($mins%60));}
                     $dsec = ($dtime%60);
                     session_register('tetime');
                     if ($dhour < 10) {$dhour = '0'.$dhour;}
                     if ($dmin < 10) {$dmin = '0'.$dmin;}
                     if ($dsec < 10) {$dsec = '0'.$dsec;}
                     $_SESSION['tetime'] = substr($dhour,0,2).':'.substr($dmin,0,2).':'.$dsec;
                    }
                else
                    {
                     session_register('tetime');
                     if ($dtime <= 9) {$_SESSION['tetime'] = '00:00:0'.$dtime;}
                         else {$_SESSION['tetime'] = '00:00:'.$dtime;}
                    }
               }
      require_once(rootpath.'enter.php');
      exit();
          }
      else
          {
           $cls->a_header('TimeOut');
           $cls->write('<div class="d1">Время вашей сессии уже истекло, пройдите авторизацию <a href="http://'.$_SERVER['SERVER_NAME'].'?action=logout&amp;'.SID.'">заново</a>.</div>');
           $cls->a_footer();
           exit();
          }
     }
     else
         {
          $cls->a_header('TimeOut');
          $cls->write('<div class="d1">Время вашей сессии уже истекло, пройдите авторизацию <a href="http://'.$_SERVER['SERVER_NAME'].'?action=logout&amp;'.SID.'">заново</a>.</div>');
          $cls->a_footer();
          exit();
         }
    }

?>