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

Размер файла: 4.54Kb
<?php

if(!isset($action)){
echo'<br><a href="pyramid/new.php?'.SID.'">Написать</a>';

if ($dostup==101 || $dostup==102 || $dostup==103){
echo'	<a href="index.php?action=areyousure&amp;'.SID.'">| Очистить</a> |
		<a href="pyramid/admin.php?'.SID.'">Настройки</a><br>';}

$text = @file("pyramid/data/setting.dat");
if ($text!=""){
$udata = explode("|",$text[0]);
$all_msg=$udata[0];
}

$file = file("pyramid/data/list.dat");
$file = array_reverse($file);
$total = count($file);
$maxlist="$all_msg";
$config_post="$all_msg";
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $maxlist){ $end = $total; }
else {$end = $start + $maxlist; }
for ($i = $start; $i < $end; $i++){
$data = explode("|",$file[$i]);
$num=$total-$i-1;
$i2=round($i+1);
echo'<br>';
$status=$data[3];
if($status=="Онлайн"){
echo'<img src="pyramid/img/on.png" alt="">';}
if($status=="Отсутствую"){
echo'<img src="pyramid/img/away.png" alt="">';}
if($status=="Занят"){
echo'<img src="pyramid/img/bisy.png" alt="">';}
if($status=="Недоступен"){
echo'<img src="pyramid/img/stop.png" alt="">';}
if($status=="Оффлайн"){
echo'<img src="pyramid/img/off.png" alt="">';}



$text = @file("pyramid/data/setting.dat");
if ($text!=""){
$udata = explode("|",$text[0]);}

echo' <font color="#'.$udata[3].'" size="'.$udata[4].'" face="'.$udata[2].'"> <a href="pyramid/anketa.php?uins='.$data[0].'&amp;'.SID.'"> '.$data[1].'</a> - '.$data[2].'</font>';

if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo '<a href="index.php?action=del&amp;line='.$num.'&amp;start='.$start.'&amp;'.SID.'"> [x]</a>';}

}


if($total>0){
echo'<br>';
$ba=ceil($total/$config_post);
$ba2=$ba*$config_post-$config_post;

$asd=$start-($config_post*3);
$asd2=$start+($config_post*4);
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_post);
if ($start==$i) {
echo ' <b>'.$ii.'</b>';
               }else{
echo ' <a href="index.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
                     }}
$i=$i+$config_post;}
if($asd2<$total){echo ' ... <a href="index.php?start='.$ba2.'&amp;'.SID.'">'.$ba.'</a>';}
}}
echo'<br><hr>';

################ Точнааааааа??
$text = @file("pyramid/data/list.dat");
if ($text!=""){
$soob = explode("|",$text[0]);}

if($action=="areyousure"){
if($soob[1]!=""){
echo'<br>Уровень?<br><a href="index.php?action=areyousure2&amp;'.SID.'">Да</a> | <a href="index.php?action=no&amp;'.SID.'">Неееет!</a><hr><br>';
}else{ echo'Нечего же удалять далбен<hr><br>';}
}

if($action=="areyousure2"){
echo'<br>Не пожалеешь?<br><a href="index.php?action=areyousure3&amp;'.SID.'">Не пожалею</a> | <a href="index.php?action=no&amp;'.SID.'">Пожалею навена</a><hr><br>';}

if($action=="areyousure3"){
echo'<br>Точно?<br><a href="index.php?action=areyousure4&amp;'.SID.'">Да</a> | <a href="index.php?action=no&amp;'.SID.'">Нет</a><hr><br>';}

if($action=="areyousure4"){
echo'<br>Ладно очишай..<br><a href="index.php?action=clear&amp;'.SID.'">Очистить</a> | <a href="index.php?'.SID.'">На главную</a><hr><br>';}

if($action=="no"){
echo'<br>А нахуй нажал?<br><hr><br>';}


########### Удаление

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

$file = file("pyramid/data/list.dat");
$fp=fopen("pyramid/data/list.dat","w");
flock ($fp,LOCK_EX);
for ($i=0;$i< sizeof($file);$i++) { if ($i==$line) {unset($file[$i]);} }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
chmod ("data/list.dat", 0666);
header ("Location: ../index.php?".SID);
}else{
header ("Location: ../index.php?".SID);
}}

########### Очитка

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

$file = file("pyramid/data/list.dat");
$fp=fopen("pyramid/data/list.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ("data/list.dat", 0666);

if ($handle = opendir('pyramid/data')){
while (false !== ($file = readdir($handle))){
if ($file != "." && $file != ".."){
$file = str_replace('.dat','',$file);
$file = str_replace('.php','',$file);
unlink("pyramid/data/$file");
}}} closedir($handle); 

header ("Location: ../index.php?".SID);
}else{
header ("Location: ../index.php?".SID); 
}}


?>