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

Размер файла: 4.72Kb
<?php
#-----------------------------------------------------#
#          ********* HOMEPHP.RU *********             #
#             Made by   :  VIP-club                   #
#               E-mail  :  homephp.ru                 #
#             WAP-Site  :  http://homephp.ru          #
#                  ICQ  :  964438                     #
#                                                     #
#-----------------------------------------------------#	
require_once ('../../includes/start.php');
require_once ('../../includes/functions.php');
require_once ('../../includes/header.php');
include_once ('../../themes/' . $config['themes'] . '/index.php');
include_once ('../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 = "";}

show_title('types.png', 'Комната смеха');
$config['newtitle'] = 'Комната смеха';


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.'2chatuser.php?'.SID.'">Управление</a>';}
echo '<hr />';

if (is_user()){
//--------------------------генерация анекдота------------------------------------------------//
if($config['shutnik']==1){

$anfi = file("../includes/chat_shut.php");
$an_rand  = array_rand($anfi);
$anshow = trim($anfi[$an_rand]);

$tifi = file(DATADIR."2chat.dat");
$tidw = explode("|",end($tifi));

if(SITETIME > ($tidw[3] + 300) && empty($tidw[6])) {

$antext = no_br($anshow.'|Весельчак||'.SITETIME.'|||1|'.$tidw[7].'|'.$tidw[8].'|');

write_files(DATADIR."2chat.dat", "$antext\r\n");
}}


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

//---------------------------------------------------------------//
$file = file(DATADIR."2chat.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/shut.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.'<a href="../../pages/anketa.php?uz=' . $data[1] . ' '.SID.'">[анк]</a></div>';
echo '<div>'.bb_code($data[0]).'<br />';
echo '</div>';
}

page_jumpnavigation('index.php?', $config['chatpost'], $start, $total);
page_strnavigation('index.php?', $config['chatpost'], $start, $total);
if (is_user()){
echo "<script language=\"JavaScript\" type=\"text/javascript\"> 
                    function ctrlEnter(event, formElem) { 
                    if ( ((event.keyCode == 13) || (event.keyCode == 10)) && (event.ctrlKey == true) )  
                    formElem.submit(); } 
                    </script>";
echo '<div class="form">';
echo '<form onkeypress="ctrlEnter(event, this);" action="add.php?'.SID.' " name="form" method="post">';
echo '<b>Сообщение:</b><br />';
    echo '<textarea cols="25" rows="3" name="msg">'.$imja.'</textarea><br />'; 
    if (!empty($udata['users_bbpanel'])) { 
      quickpaste('msg'); 
      quickcode(); 
      quicksmiles(); 
    }
echo '<input value="Отправить" type="submit" /> (Ctrl+Enter)</form></div>';

} else {show_login('Вы не авторизованы, чтобы добавить сообщение, необходимо');}
} 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 />';
echo '<img src="../../images/img/homepage.gif" alt="image" /> <a href="../../index.php?'.SID.'">На главную</a>'; 

include_once ("../../themes/".$config['themes']."/foot.php");
?>