Просмотр файла wwphpmaster2.00_released/www.phpedited.com/wap/gb/index.php

Размер файла: 7.86Kb
<?php
////////////////////////////////////////////////////////////////////////////
//               -_- W|W PHP-master -_-                                   //
//                                                                        //
//                Copyright 2008 MyIE                                     //
//  Create and Design by -_- MyIE                                         //
//  Site (web)           -_- http://www.phpedited.com                     //
//  Site (wap)           -_- http://wap.phpedited.com                     //
//  E-mail (MyIE)        -_- [email protected]                           //
//  ICQ (MyIE)           -_- 952-11-78                                    //
//                                                                        //
//  Вы не имеете право убирать копирайт                                   //
//  оффициального сайта!                                                  //
//This program is free software: you can redistribute it and/or modify    //
//it under the terms of the GNU General Public License as published by    //
//the Free Software Foundation, either version 3 of the License, or       //
//(at your option) any later version.                                     //
//                                                                        //
//This program is distributed in the hope that it will be useful,         //
//but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            //
//GNU General Public License for more details.                            //
//                                                                        //
//You should have received a copy of the GNU General Public License       //
//along with this program. If not, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////
require_once"../tmpl/cnf.php";
require_once"../tmpl/func.php";
require_once"../tmpl/ses.php";
require_once"../tmpl/hd.php";
require_once"../tmpl/err.php";
?>
<table border=0 cellspacing=5 cellpadding=0 width=100%>
<tr>
<td><div class=a>
Гостевая книга
</div></td>
</tr>
<tr>
<td>
<?php
if ($_SESSION)
{
?>
<table width=1 border=0>
<?php
echo "<form action='gb_add.php?name=$log' method='post'>";
?>
<tr>
<td colspan=2>Сообщение:<font color=red></font><br>
<textarea cols=18 rows=3 name=msg class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><input type=submit value='Добавить' class=submit></td>
</tr>
</form>
</table>

<?php
}
$file=fopen("../lcl/perm_gb.dt","r");
$guest=fgets($file);
if ((!$_SESSION) && ($guest==1))
{
?>
<table width=1 border=0>
<form action='gb_add.php?name=guest' method=post>
<tr>
<td colspan=2>Сообщение | post:<br>
<textarea cols=18 rows=3 name=msg class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><input type=submit value='Добавить' class=submit></td>
</tr>
</form>
</table>
<?php
}
if ((!$_SESSION) && ($guest==0))
{
?>
<center>
<table border=0 width=100%>
<tr>
<td align=center><font color=00FF00>Для добавления сообщения необходимо авторизоваться</font></td>
</tr>
</table>
</center>
<?php
}
?>

<?php
////////////////////////////////////
$dir_rec = dir("../lcl/gb/");
$i = 0;
while($entry = $dir_rec->read())
{
if (substr($entry,0,3)=="rec")
{
$names[$i]=substr($entry,4);
$i++;
}
}
$dir_rec->close(); // закрываем директорию
@rsort($names); // сортируем файлы
$total=$i;
// число постов на страницу
$file=fopen("../lcl/msg_gb.dt","r");
$mgs_gb=fgets($file);

// определяем очередность сообщений и выводим их
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $mgs_gb) { $end = $total; }
else {$end = $start + $mgs_gb; }
for ($i = $start; $i < $end; $i++)
{
$entry = $names[$i];
$data = file("../lcl/gb/rec.".$entry);
$date = $entry;
$name = trim($data[0]);
$msg = trim($data[1]);
// делаем bb-code
$msg = str_replace("[color=red]","<font color=red>",$msg);
$msg = str_replace("[color=blue]","<font color=blue>",$msg);
$msg = str_replace("[color=green]","<font color=00ff00>",$msg);
$msg = str_replace("[color=yellow]","<font color=yellow>",$msg);
$msg = str_replace("[/color]","</font>",$msg);
$msg = str_replace("[u]","<u>",$msg);
$msg = str_replace("[U]","<u>",$msg);
$msg = str_replace("[i]","<i>",$msg);
$msg = str_replace("[I]","<i>",$msg);
$msg = str_replace("[b]","<B>",$msg);
$msg = str_replace("[B]","<B>",$msg);
$msg = str_replace("[sub]","<SUB>",$msg);
$msg = str_replace("[SUB]","<SUB>",$msg);
$msg = str_replace("[sup]","<SUP>",$msg);
$msg = str_replace("[SUP]","<SUP>",$msg);
$msg = str_replace("[/u]","</u>",$msg);
$msg = str_replace("[/U]","</u>",$msg);
$msg = str_replace("[/i]","</i>",$msg);
$msg = str_replace("[/I]","</i>",$msg);
$msg = str_replace("[/b]","</B>",$msg);
$msg = str_replace("[/B]","</B>",$msg);
$msg = str_replace("[/SUB]","</SUB>",$msg);
$msg = str_replace("[/sub]","</SUB>",$msg);
$msg = str_replace("[/SUP]","</SUP>",$msg);
$msg = str_replace("[/sup]","</SUP>",$msg);
$msg = eregi_replace("(.*)\\[url\\](.*)\\[/url\\](.*)","\\1<ahref=\\2>\\2</a>\\3",$msg);
$msg = str_replace("[br]","<br>",$msg);
$msg = str_replace(";)","<img src='../img/bb_icons/smile.gif'>",$msg);
$msg = str_replace(":dance:","<img src='../img/bb_icons/4.gif'>",$msg);
$msg = str_replace(";(","<img src='../img/bb_icons/2.gif'>",$msg);
$msg = str_replace(":ok:","<img src='../img/bb_icons/9.gif'>",$msg);
$msg = str_replace(":shit:","<img src='../img/bb_icons/13.gif'>",$msg);
$msg = str_replace(":star:","<img src='../img/bb_icons/star.gif'>",$msg);
$msg = str_replace(":rofl:","<img src='../img/bb_icons/rofl.gif'>",$msg);
$msg = str_replace(":punish2:","<img src='../img/bb_icons/punish2.gif'>",$msg);
$msg = str_replace(":friends:","<img src='../img/bb_icons/friends.gif'>",$msg);
$msg = str_replace(":tease:","<img src='../img/bb_icons/tease.gif'>",$msg);
$msg = str_replace(":padonak:","<img src='../img/bb_icons/padonak.gif'>",$msg);
$msg = str_replace(":wild:","<img src='../img/bb_icons/wild.gif'>",$msg);
/////////////////////////
echo "<table border=0 width=100%>";
echo "<tr>";
if ($name!="guest") { echo "<td bgcolor=#666666 width=100%><a href='../usr/prosmotr.php?log_pr=$name' class=cool>$name</a>"; }
else { echo "<td bgcolor=#666666 width=100%>$name"; }
////////// проверка на админа ////////
if ($_SESSION)
{
$files_array = file("../lcl/prof/$log");
if(!$files_array)
	{
echo("Ошибка открытия файла");
	}
if (($files_array[2]==101) || ($files_array[2]==102) || ($files_array[2]==103))
	{
echo (" <a href='gb_edit.php?date=$date' class=cool>[edit]</a> <a href='../tmpl/gb_del.php?date=$date' class=cool>[del]</a>");
	}
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=100%>$msg</td>";
echo "<tr>";
echo "</table>";
}
echo'<hr>';
// Вывод выбора далее\назад

if ($start != 0) {echo '<a href="index.php?start='.($start - $mgs_gb).'" class=forum2>&lt;-Назад</a> ';}else{echo'&lt;-Назад ';}
echo'|'; 
// Вывод выбора страницы
if($total>0)
{

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

$asd=$start-($mgs_gb*4);
$asd2=$start+($mgs_gb*5);

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

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

if ($start==$i) {
echo ' <b>'.$ii.'</b>';
               }
                else {
echo ' <a href="index.php?start='.$i.'" class=forum2>'.$ii.'</a>';
                     }
}
$i=$i+$mgs_gb;
}
if($asd2<$total) { echo ' ... <a href="index.php?start='.$ba2.'" class=forum2>'.$ba.'</a>'; }
}
echo' |'; 
if ($total > $start + $mgs_gb) {echo ' <a href="index.php?start='.($start + $mgs_gb).'" class=forum2>Далее -&gt;</a>';}else{echo' Далее-&gt;';}

?>
</td>
</tr>
</table>

<?php
require_once"../tmpl/dw.php";
decoder();
echo "</BODY>";
echo "</HTML>";
?>