Просмотр файла mi-ch/index.php

Размер файла: 7.55Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";

function avto($s) { 
$rand = mt_rand(100,999); 
global $config_chatrew;
$s = str_replace("<title>","<meta http-equiv=\"refresh\" content=\"$config_chatrew;URL=index.php?rand=$rand&amp;".SID."\" /><title>",$s);
return $s; }
ob_start("avto");
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";
$rand = rand(100,999); 
if (isset($_GET['start'])){$start = (int)$_GET['start'];} else {$start = 0;}
if (isset($_GET['imja'])){$imja = check($_GET['imja']).', ';} else {$imja = "";}

echo'<img src="../images/img/partners.gif" alt=""> <b>История чата</b><br><br>';

if($config_themes!="wml"){echo '<a href="#down"><img src="../images/img/downs.gif" alt=""></a> ';}
echo '<a href="index.php?r='.$rand.'&amp;'.SID.'"> Обновить</a>';

if($provpar==md5($_SESSION['par']) && $provlog==$_SESSION['log']) {
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo ' | <a href="../'.$config_mpanel.'/chat.php?start='.$start.'&amp;'.SID.'">Управление</a>';}}

$file=file(BASEDIR."mi-ch/templ/base.dat");
$i = count($file);
if ($i>=$config_maxpostchat) {
$fp=fopen(BASEDIR."mi-ch/templ/base.dat","w");
flock ($fp,LOCK_EX);
unset($file[0],$file[1],$file[2],$file[3],$file[4]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}


if ($to!=="" && $to!==null){if ($go!=="" && $go!==null){$go="$go";}$to=nickname($to);if ($go!="") {$to="$to $go, ";}else{$to="$to, ";}}
if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){

if($config_themes!="wml"){	
echo'<br><hr><form action="addtext.php?'.SID.'" name="form" method="post">';
echo'<b>Сообщение:</b><br>';
echo'<textarea cols="20" rows="3" name="msg">'.$imja.'</textarea><br>';

if($config_translit=="1"){
echo'Транслит: <input name="trans" type="checkbox" value="y" /><br>';}

if(!empty($udata[67])){
echo "<script language=\"JavaScript\" type=\"text/javascript\">  function tag(text1, text2) {      if ((document.selection)) { document.form.msg.focus();        document.form.document.selection.createRange().text = text1+document.form.document.selection.createRange().text+text2;      } else if(document.forms['form'].elements['msg'].selectionStart != undefined) {          var element    = document.forms['form'].elements['msg'];          var str     = element.value;          var start    = element.selectionStart;          var length    = element.selectionEnd - element.selectionStart;          element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);      } else document.form.msg.value += text1+text2;   }</script>";
include_once BASEDIR."template/quicksmiles.php";
}
echo'<input type="submit" value="Добавить" /></form><hr>';

}else{

echo'Сообщение:<br>';
echo'<input name="msg" value="'.$imja.' "/><br>';

if($config_translit=="1"){
echo'Транслит: <select name="trans"><option value="0">Нет</option>';
echo'<option value="y">Да</option>';
echo'</select><br>';}

echo'<anchor>Сказать';
echo'<go href="addtext.php?'.SID.'" method="post">';
echo'<postfield name="msg" value="$(msg)"/>';
echo'<postfield name="trans" value="$(trans)"/>';
echo'</go></anchor><br>--------------------<br>';
}

}else{

echo '<br>Вы не авторизованы, чтобы добавить сообщение, необходимо<br>';
echo '<b><a href="../pages/vhod.php?'.SID.'">Авторизоваться</a></b> или в начале <b><a href="../pages/registration.php?'.SID.'">Зарегистрироваться</a></b><br><br>';
}

$file = file(BASEDIR."mi-ch/templ/base.dat");
$file = array_reverse($file);
$total = count($file);    

if($total<1){echo'<br><img src="../images/img/reload.gif" alt=""> <b>Сообщений нет, будь первым!</b><br>';}

$start = (int)$_GET['start'];
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]);

$data[0]=bb_code($data[0]);

$ava = file(BASEDIR."local/profil/$data[1].prof"); 
$avv = explode(":||:",$ava[0]);
$statwho=user_online($data[1]);

echo '<div class="b">';
if(!empty($udata[45])){
if($avv[43]!="" && $avv[43]!="noavatar.gif"){	
echo ' <small> ('.date_fixed($data[3]).')   </small><br><img src="../'.$avv[43].'" alt=""> ';}else{
echo '<img src="../images/avators/noavatar.gif" alt=""> '; }
}else{
echo '   <small> ('.date_fixed($data[3]).')   </small><br><img src="../images/img/edit.gif" alt=""> ';
}
echo'<b><a href="../pages/anketa.php?uz='.$data[1].''.SID.'">'.nickname($data[1]).'</a></b> ';
if($avv[15]=="Ж"){echo' <img src="../images/img/woman.gif" alt=""> ';}else{if($avv[15]=="M"){echo' <img src="../images/img/man.gif" alt=""> ';}}
echo' '.user_online($data[1]).' ';
$uzertime=substr($avv[18],0,5);$montime=date_fixed($sitetime,"d.m");if($uzertime==$montime){echo' <img src="../images/cake.png" alt=""/> ';}
echo'<br>'.user_title($data[1]).'<br>';
if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){
if($log!=$data[1]){
echo '[<a href="../mi-ch/answer.php?imja='.$data[1].'&amp;'.SID.'">отв.</a>] | [<a href="../pages/privat.php?action=submit&uz='.$data[1].'&amp;'.SID.'">л.с.</a>] ';}
}

echo '</div>'.$data[0].'<hr>';
if ($avv[68]!="") {echo'[<b>'.check($avv[68]).'</b>]<br>';}
echo'<font color="#CC00CC"><small>('.$data[4].', '.$data[5].')</small></font></div>';

}

echo'<hr>';   
if ($start != 0) {echo '<a href="index.php?start='.($start - $config_chatpost).'&amp;'.SID.'">&lt;-Назад</a>';}else{echo'&lt;-Назад';}
echo' | '; 
if ($total > $start + $config_chatpost) {echo ' <a href="index.php?start='.($start + $config_chatpost).'&amp;'.SID.'">Далее -&gt;</a>';}else{echo'Далее-&gt;';}



if($total>0){

$ba=ceil($total/$config_chatpost);
$ba2=$ba*$config_chatpost-$config_chatpost;

echo '<br><hr>Страницы:';
$asd=$start-($config_chatpost*4);
$asd2=$start+($config_chatpost*5);

if($asd<$total && $asd>0){echo ' <a href="index.php?start=0&amp;'.SID.'">1</a> ... ';}

for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_chatpost);

if ($start==$i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
}}

$i=$i+$config_chatpost;}
if($asd2<$total){echo ' ... <a href="index.php?start='.$ba2.'&amp;'.SID.'">'.$ba.'</a>';}
}


echo '<br><br>';
if($config_themes!="wml"){echo '<a href="#up"><img src="../images/img/ups.gif" alt=""></a> ';}
echo '<a href="index.php?rand='.$rand.'&amp;'.SID.'">Обновить</a> | ';
echo '<a href="../pages/pravila.php?'.SID.'">Правила</a> | ';
echo '<a href="../pages/smiles.php?'.SID.'">Смайлы</a> | ';
echo '<a href="../pages/tegi.php?'.SID.'">Теги</a><br>';


echo '<img src="../images/img/chat.gif" alt=""> <a href="topchat.php?'.SID.'">Топ чата</a><br>'; 
echo '<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>'; 
include_once"../themes/$config_themes/foot.php";
?>