Вход Регистрация
Файл: chat.php
Строк: 154
<?
    
include './system/common.php';
    
include 
'./system/functions.php';
         
include 
'./system/user.php';
    
if(!
$user) { header('location: /'); exit; }

$title = ($_GET['clan'] == true) ? '':'
'
;


include 
'./system/h.php';  

echo 
'<div class='title'>'.$title.'</div>
<div class='
line'></div>';

if(
$user['save'] == 0) {

  echo 
'<div class='content'><font color='#909090'>Для общения в чате вам нужно сохранить своего персонажа</font></div>';

}
else
{

  echo 
'<div class='menu'>';


  if(
$user['level'] < 10) {

    echo 
'<font color='#909090'>Писать в чат можно с <img src='/images/icon/level.png' alt=''/> 10 уровня</font>';

  
}
  else
  {

$text _string($_POST['text']);
  
$to _string(_num($_GET['to']));

  if(
$to) {

      
$_to mysql_query('SELECT * FROM `users` WHERE `id` = "'.$to.'"');
      
$_to mysql_fetch_array($_to);
  
  if(!
$_to OR $_to['id'] == $user['id']) {
  
    
header('location: /chat/'.($_GET['clan'] == true 'clan/':''));
    
  exit;
  
  }
  
  }

  if(
$text && $user['level'] > 2) {
  
    
$antiflood mysql_fetch_array(mysql_query('SELECT * FROM `chat` WHERE `clan` = ''.($_GET['clan'] == true ? $clan['id']:0).'' AND `user` = ''.$user['id'].'' ORDER BY `time` DESC LIMIT 1'));
  
    if(
time() - $antiflood['time'] < 30$errors[] = 'Ошибка, писать можно 1 раз в 30 секунд';

    if(
$errors) {
    
      echo 
'<div class='content' align='center'>';
      
      foreach(
$errors as $error) {
        
        echo 
$error.'<br/>';
        
      }
    
      echo 
'</div>
      <div class='
line'></div>';
    
    }
    else
    {

      if(
$_to) {
      
        
$text str_replace($_to['login'].', '''$text);
      
      }
      
    
//    $text = eregi_replace( "[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "Попытка рекламы", $text);
        
      /*  $text = str_replace(array('ru',
                                 'net',
                                 'com',
                                  'рф',
                                  'tk',
                                  'su',
                                  't k',
                                  'us',
                                'mobi',
                                  'ua',
                                 'www',
                                'http'), '*', $text);
*/
      
        
mysql_query('INSERT INTO `chat` (`clan`,
                                         `user`,
                                           `to`,
                                         `text`,
                                         `time`) VALUES ("'
.($_GET['clan'] == true $clan['id']:0).'",
                                                         "'
.$user['id'].'", 
                                                          "'
.$_to['id'].'",
                                                               "'
.$text.'",
                                                              "'
.time().'")');
      
      
header('location: /chat/'.($_GET['clan'] == true 'clan/':''));
  
    }
  
  }

?>

<div class="ribbon mb2"><div class="rl"><div class="rr">

    &#1063;&#1072;&#1090;</div></div></div>

<div class="bdr bg_main mb2"><div class="light"><div class="wr1"><div class="wr2"><div class="wr3"><div class="wr4"><div class="wr5"><div class="wr6"><div class="wr7"><div class="wr8">
<div class="cntr mb5 mt5 lh1"><img class="va_t" src="http://144.76.127.94/view/image/art/ico16-grey_refresh.png" width="16" height="16" alt=""/> <a class="grey1" href='/chat/<?=($_GET['clan'] == true 'clan/':'')?>'><font color='#909090'>&#1054;&#1073;&#1085;&#1086;&#1074;&#1080;&#1090;&#1100;</font></a></div>
<div class="hr_arr mlr10 mb5"><div class="alf"><div class="art"><div class="acn"></div></div></div></div>

 <div class="mlr10 lwhite">
<form action='/chat/<?=($_GET['clan'] == true 'clan/':'')?>?to=<?=$to?>' method='post'>
 
    <input type='submit' class="ibtn w90px fr" value='&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1100;'/> 

  <div class="mr95 lft">

                <input class="lbfld h25 w96" type="text" value=""<?=($to $_to['login'].', ':'')?>"" size="20" maxlength="255" name="text"/>

            </div>

            <input type="hidden" name="page" value="1"/>

            

  </form>
    </div>
    
<?

}

?>

  

<?

    $max 
15;
  
$count mysql_result(mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true $clan['id']:0).'"'),0);
  
$pages ceil($count/$max);
   
$page _string(_num($_GET['page']));

    if(
$page $pages) {
    
   
$page $pages;
    
    }
  
    if(
$page 1) {
    
   
$page 1;
    
    }
    
  
$start $page $max $max;

if(
$count 0) {



$msg _string(_num($_GET['msg']));

       if(
$msg) {

    
$i_msg mysql_query('SELECT * FROM `chat` WHERE `id` = "'.$msg.'"');
    
$i_msg mysql_fetch_array($i_msg);

    if(!
$i_msg) {
    
      
header('location: /chat/'.($_GET['clan'] == true 'clan/':'').'?page='.$page);
      exit;
    
    }

    if(
$_GET['clan'] == true && $clan_memb['rank'] == OR $user['access'] > 0) {
        
      
mysql_query('DELETE FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true $clan['id']:0).'" AND`id` = "'.$i_msg['id'].'"');

    }

    
header('location: /chat/'.($_GET['clan'] == true 'clan/':'').'?page='.$page);

  }



$q mysql_query('SELECT * FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true $clan['id']:0).'" ORDER BY `id` DESC LIMIT '.$start.', '.$max.'');
  while(
$row mysql_fetch_array($q)) {

  if(
$row['to'] == $user['id'] && $row['read'] == 0) {
  
    
mysql_query('UPDATE `chat` SET `read` = "1" WHERE `id` = "'.$row['id'].'"');
  
  }

  
$sender mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
  
$sender mysql_fetch_array($sender);

?>

<img src='/images/icon/race/<?=$sender['r'].($sender['online'] > (time() - 600) ? '':'-off')?>.png' alt='*'/>

<a href='/user/<?=$sender['id']?>/'><?=$sender['login']?></a><?

  
if($sender['id'] != $user['id']) {

?> <a href='/chat/<?=($_GET['clan'] == true 'clan/':'')?>?to=<?=$sender['id']?>'>(&#187;)</a><?

  
}
?><?

    
if($row['to']) {

      
$__to mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['to'].'"');
      
$__to mysql_fetch_array($__to);

if(
$__to['id'] == $user['id']) {

?>

<font color='#90c090'>

<?

    
}

?>

<?=$__to['login']?>,

<?

if($__to['id'] == $user['id']) {

?>

</font>

<?

    
}
    
    }

    if(
$sender['access'] == 1) {

?>

<font color='#f09060'>

<?

    
}

?>

<?

    
if($sender['access'] == 2) {

?>

<font color='red'>

<?

    
}

?>


<?=smiles($row['text'])?>

<?

    
if($sender['access'] > 0) {

?>

</font>

<?

    
}

  if(
$user['access'] > 0) {


?>

<a href='/chat/<?=($_GET['clan'] == true 'clan/':'')?>?msg=<?=$row['id']?>'>[x]</a>

<?

  
}
  
?>

<br/>

<?

  
}

  }
  else
  {
  
?>



<?
  
  
}

?>



<?

  
if($clan) {
  
     
$_chat mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "0" AND `to` = "'.$user['id'].'" AND `read` = "0"');
     
$_chat mysql_result($_chat,0);

$_clan_chat mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.$clan['id'].'" AND `to` = "'.$user['id'].'" AND `read` = "0"');
$_clan_chat mysql_result($_clan_chat,0);

?>

  <center><small><img src='/images/icon/chat.png' alt='*'/> <?=($_GET['clan'] == true '<a href='/chat/'>Общий</a>':'<font color='#606060'>Общий</font>')?> <?=($_chat '<font color='#30c030'>(+)</font>':'')?> | <?=($_GET['clan'] == true '<font color='#606060'>Клан</font>':'<a href='/chat/clan/'>Клан</a>')?> <?=($_clan_chat '<font color='#30c030'>(+)</font>':'')?></small></center>

<?

  
}

?>



<?=pages('/chat/'.($_GET['clan'] == true 'clan/':'').'?');?>




<?

  
if($_GET['read_all'] == true) {

    
mysql_query('UPDATE `chat` SET `read` = "1" WHERE '.($_GET['clan'] == true '`clan` = "'.$clan['id'].'" AND':'').' `to` = "'.$user['id'].'"');
    
    
header('location: /chat/'.($_GET['clan'] == true 'clan/':''));
  
  }

?>




</div>
</div></div></div></div></div></div></div></div></div></div>

    <div class="hr_g mb2"><div><div></div></div></div>
<div class="bntf"><div class="small"><div class="nl"><div class="nr cntr lyell small lh1 plr15 pt5 pb5 sh">

        &#1055;&#1086;&#1078;&#1072;&#1083;&#1086;&#1074;&#1072;&#1090;&#1100;&#1089;&#1103; &#1085;&#1072; &#1085;&#1072;&#1088;&#1091;&#1096;&#1077;&#1085;&#1080;&#1077; <a href="/rules2">&#1087;&#1088;&#1072;&#1074;&#1080;&#1083; &#1095;&#1072;&#1090;&#1072;</a> &#1084;&#1086;&#1078;&#1085;&#1086; <a href="/moderators?chat=1">&#1052;&#1086;&#1076;&#1077;&#1088;&#1072;&#1090;&#1086;&#1088;&#1072;&#1084;</a>        </div></div></div></div>

    <div class="hr_g mb2"><div><div></div></div></div>


<?

}

include 
'./system/f.php';

?>
Онлайн: 1
Реклама