Просмотр файла chat/1/index.php

Размер файла: 5.25Kb
<?php
require_once ('../../includes/start.php');
require_once ('../../includes/functions.php');
require_once ('../../includes/header.php');
require_once ('../../themes/header.php');
require_once ('../../chat/includes/functions.php');

if (isset($_GET['start'])) {$start = abs(intval($_GET['start']));} else {$start = 0;}
if (isset($_GET['imja'])){$imja = '[b]'.safe_decode(check($_GET['imja'])).'[/b], ';} else {$imja = "";}

if (empty($_GET['uz'])) {
  $uz = check($log);
} else {
  $uz = check(strval($_GET['uz']));
} 

show_title('types.png', 'Комната умников');
$config['newtitle'] = 'Комната умников';

echo '<a href="#down"><img src="../../images/img/downs.gif" alt="down" /></a> ';
echo '<a href="index.php?rand='.mt_rand(100,999).'&amp;'.SID.'">Обновить</a>';
if (is_admin(array(101,102,103,105))){echo ' | <a href="'.ADMINDIR.'1chatuser.php?'.SID.'">Управление</a>';}
if (is_user()){
				echo '<hr />';
				echo '<form action="add.php?'.SID.'" name="form" method="post">';
				echo '<b>Сообщение:</b><br />';
				echo '<textarea cols="25" rows="5" name="msg">'.$imja.'</textarea><br />';
    if (!empty($udata['users_bbpanel'])) { 
      quickpaste('msg'); 
      quickcode(); 
      quicksmiles(); 
    }
				echo '<input type="submit" value="Написать" /></form>';

} else {show_login('Вы не авторизованы, чтобы добавить сообщение, необходимо');}
echo '<hr />';

if (is_user()){

//------------------------------- Ответ на вопрос ----------------------------------//
if ($config['magnik']==1){

$mmagfi = file(DATADIR."1chat.dat");
$mmagshow = explode("|",end($mmagfi));

if($mmagshow[8]!="" && SITETIME>$mmagshow[7]){ 

$magtext = no_br('На вопрос никто не ответил, правильный ответ был: [b]'.$mmagshow[8].'[/b]! Следующий вопрос через 1 минуту|Якубович||'.SITETIME.'|||0|'.(SITETIME + 60).'||');

write_files(DATADIR."1chat.dat", "$magtext\r\n");
}

//------------------------------  Новый вопрос  -------------------------------//
$magfi = file("../includes/chat_mag.php");
$mag_rand = array_rand($magfi);
$magshow = $magfi[$mag_rand];
$magstr = explode("|",$magshow); 

if (empty($mmagshow[8]) && SITETIME>$mmagshow[7] && $magstr[0]!=""){ 

$strlent = utf_strlen($magstr[1]);

if ($strlent>1 && $strlent<5){$podskazka="$strlent буквы";} else {$podskazka="$strlent букв";}

$magtext = no_br('Вопрос всем: '.$magstr[0].' - ('.$podskazka.')|Якубович||'.SITETIME.'|||0|'.(SITETIME + 600).'|'.$magstr[1].'|');

write_files(DATADIR."1chat.dat", "$magtext\r\n");
}}

//----------------------------  Подключение бота  -----------------------------------------//
if($config['botnik']==1){
if(empty($_SESSION['botochat'])){
	
$hellobots = array('К нам присоединились:'); 
$hellobots_rand = array_rand($hellobots); 
$hellobots_well = $hellobots[$hellobots_rand];

$mmagfi = file(DATADIR."1chat.dat");
$mmagshow = explode("|",end($mmagfi));

$weltext = no_br($hellobots_well.' '.nickname($log).'!|Система||'.SITETIME.'|||0|'.$mmagshow[7].'|'.$mmagshow[8].'|');

write_files(DATADIR."1chat.dat", "$weltext\r\n");

$_SESSION['botochat']=1;
}}

$countstr = counter_string(DATADIR."1chat.dat");
if ($countstr>=$config['maxpostchat']) {
delete_lines(DATADIR."1chat.dat", array(0,1,2,3,4));
}
}

//---------------------------------------------------------------//
$file = file(DATADIR."1chat.dat");
$file = array_reverse($file);
$total = count($file);    

if ($total>0){

if ($start < 0 || $start >= $total){$start = 0;}
if ($total < $start + $config['chatpost']){ $end = $total; }
else {$end = $start + $config['chatpost']; }
for ($i = $start; $i < $end; $i++){

$data = explode("|",$file[$i]);

$useronline = user_online($data[1]);
$useravatars = user_avatars($data[1]);
$usertitle = user_title($data[1]);
if ($data[1]=='Якубович'){$useravatars='<img src="img/mag.gif" alt="image" /> '; $useronline='<span style="color:#00ff00">[On]</span>';}
if ($data[1]=='Система'){$useravatars='<img src="img/199.gif" alt="image" /> '; $useronline='<span style="color:#00ff00">[On]</span>';}

echo '<div class="b">';
echo '<div class="img">' . $useravatars . '</div>';
echo '<b><a href="index.php?imja='.safe_encode(nickname($data[1])).'&'.SID.'#form">'.nickname($data[1]).'</a></b>  <small>('.date_fixed($data[3]).')</small><br />';
echo $usertitle;  
echo $useronline.'</div>';
echo '<div>'.bb_code($data[0]).'<br />';
echo '</div>';
}

			page_strnavigation('index.php?', $config['bookpost'], $start, $total);

} else {show_error('Сообщений нет, будь первым!');}



  echo '<a href="#up"><img src="../../images/img/ups.gif" alt="image" /></a> ';
  echo '<a href="../../pages/rules.php?' . SID . '">Правила</a> | ';
  echo '<a href="../../pages/smiles.php?' . SID . '">Смайлы</a> | ';
  echo '<a href="../../pages/tegi.php?' . SID . '">Теги</a><br /><br />';
echo '<img src="../../images/img/reload.gif" alt="image" /> <a href="../index.php?'.SID.'">К комнатам</a><br />';

include_once ('../../themes/footer.php');
?>