View file mi-ch/templ/index.php

File size: 2.98Kb
<?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' <a href="../mi-ch/say.php?'.SID.'">Написать </a> | <a href="../mi-ch/index.php?'.SID.'">История</a><br>';

if ($action=="") {
$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);}

$file = file(BASEDIR."mi-ch/templ/base.dat");
$file = array_reverse($file);
$total = count($file);    
if($total<1){echo'<img src="../images/img/reload.gif" alt=""> <b>Сообщений нет, будь первым!</b><br>';}
$start=0;
$config_maxpostchat = 3;
$start = (int)$_GET['start'];
if($start < 0 || $start > $total){$start = 0;}
if ($total < $start +3){ $end = $total; }
else {$end = $start + 3; }
for ($i = $start; $i < $end; $i++){
$data = explode("|",$file[$i]);
$data[0]=bb_code($data[0]);
echo '<div class="b">   <small> ('.date_fixed($data[3]).')   </small><br>';
$int = file(BASEDIR."local/profil/$data[1].prof");
$intro = explode(":||:",$int[0]);
if($intro[15]=="Ж"){echo'<img src="images/img/woman.gif" alt=""> ';}else{if($intro[15]=="M"){echo'<img src="images/img/man.gif" alt=""> ';}}
echo'<b>'.nickname($data[1]).'</b> ';
echo' '.user_online($data[1]).' ';
$uzertime=substr($intro[18],0,5);$montime=date_fixed($sitetime,"d.m");if($uzertime==$montime){echo' <img src="images/cake.png" alt=""/> ';}
echo'<br>';
echo''.user_title($data[1]).'<br>';
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo ' [<a href="index.php?action=del&rd='.($total-$i-1).'"><font color="red">удл.</font></a>] ';
}
if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){
if($log!=$data[1]){echo '[<a href="../mi-ch/say1.php?imja='.$data[1].'&amp;'.SID.'">отв.</a>] | [<a href="../pages/privat.php?action=submit&uz='.$data[1].'&amp;'.SID.'">л.с.</a>] ';}
}
echo '</div>'.$data[0].'';
}
echo'<hr>';

}
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){if($total>1){echo '<img src="../images/img/error.gif" alt=""/> <a href="index.php?action=clear&amp;'.SID.'">Очистить </a></br>';}}
if($action=="clear"){if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){clear_files(BASEDIR."mi-ch/templ/base.dat");header ("Location: index.php?isset=clear&".SID);}}

if ($action=="del") {
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){

if (isset($rd))  {
$file=file(BASEDIR."mi-ch/templ/base.dat");
$fp=fopen(BASEDIR."mi-ch/templ/base.dat","w");
flock ($fp,LOCK_EX);
for ($i=0;$i< sizeof($file);$i++) { if ($i==$rd) {unset($file[$i]);} }
fputs($fp, implode($file));
flock ($fp,LOCK_UN);
fclose($fp);
}
header ("Location: index.php?isset=delpriv&".SID);	

}}

?>