Просмотр файла wwphpmaster1.02/www.phpedited.com/gb/index.php

Размер файла: 9.69Kb
<?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"../js/bb_code.php";
require_once"../tmpl/hd_dw.php";

$f=fopen("../wap/lcl/panel1.dt","r");
$ifda=fgets($f);
$ifda=trim($ifda);
if ($ifda==1)
{
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td valign=_top>";
require_once"../panel/panel1q.php";
echo "</td>";
echo "<td width=100% valign=_top>";
}
else
{
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td valign=_top width=100%>";
}
?>

<table border=0 cellspacing=5 cellpadding=0 width=100%>
<tr>
<?php
echo("<td background='../thm-wb/$url_thm/pls.gif' align=center>");
echo("<img src='../thm-wb/$url_thm/plsl.gif' align=left>");
echo("<img src='../thm-wb/$url_thm/plsr.gif' align=right>");
?> 
Гостевая книга
</td>
</tr>
<tr>
<td>
<?php
if ($_SESSION)
{
?>
<center>
<table width=1 border=0>
<form action='gb_add.php' method='post' name="formular" onsubmit=SubmitControl(this)>
<tr>
<td width=50%>Имя | nikname:</td>
<td align=right>
<?php
echo ("<input type=text name=name maxlength=32 value='$log' class=input>");
?>
</td>
</tr>
<tr>
<td colspan=2>
<div class="bb_bar">
<img src="../wap/img/bb_icons/smile.gif" onClick="insert(' ;) ', '')"/>
<img src="../wap/img/bb_icons/4.gif" onClick="insert(' :dance: ', '')"/>
<img src="../wap/img/bb_icons/2.gif" onClick="insert(' ;( ', '')"/>
<img src="../wap/img/bb_icons/8.gif" onClick="insert(' :lol: ', '')"/>
<img src="../wap/img/bb_icons/9.gif" onClick="insert(' :ok: ', '')"/>
<img src="../wap/img/bb_icons/13.gif" onClick="insert(' :shit: ', '')"/>
<img src="../wap/img/bb_icons/star.gif" onClick="insert(' :star: ', '')"/>
<br>
<input type="button" style="width: 50px;" class=submit value=" B " onClick="insert('[b]', '[/b]')"/>
<input type="button" style="width: 50px;" class=submit value=" I " onClick="insert('[i]', '[/i]')"/>
<input type="button" style="width: 50px;" class=submit value=" U " onClick="insert('[u]', '[/u]')"/>
<input type="button" style="width: 50px;" class=submit value="URL" onClick="insert('[url]', '[/url]')"/>
<input type="button" style="width: 50px;" class=submit value="IMG" onClick="insert('[img]', '[/img]')"/>
<input type="button" style="width: 50px;" class=submit value="SUP" onClick="insert('[sup]', '[/sup]')"/>
</div>
<textarea cols=40 rows=5 name=msg class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><center><input type=submit value='Добавить' class=submit></center></td>
</tr>
</form>
</table>
</center>
<?php
}
$file=fopen("../wap/lcl/perm_gb.dt","r");
$guest=fgets($file);
if ((!$_SESSION) && ($guest==1))
{
?>
<center>
<table width=1 border=0>
<form action='gb_add.php' method='post' onsubmit=SubmitControl(this)>
<tr>
<td width=50%>Имя | nikname:</td>
<td align=right>
<input type=text name=name maxlength=32 value='' class=input>
</td>
</tr>
<tr>
<td colspan=2>Сообщение | post:<br>
<textarea cols=40 rows=5 name=msg class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><input type=submit value='Добавить' class=submit></td>
</tr>
</form>
</table>
</center>
<?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("../wap/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); // сортируем файлы
// определяем очередность сообщений и выводим их
$count = $i;
$count1 = $count;
if (empty($start))
{
$start = 0;
}
$start = intval($start);
if ($start < 0)
{
$start = 0;
}
print "<center>";
$file=fopen("../wap/lcl/msg_gb.dt","r");
$mgs_gb=fgets($file);

if ($count > $start + $mgs_gb) $count = $start + $mgs_gb;
if ($start != 0)
{
print "<A href=index.php?start=".($start - $mgs_gb)."> Предыдущие </A>";
}
if ($count1 > $start + $mgs_gb)
{
print "<A href=index.php?start=".($start + $mgs_gb)."> Следующие </A> \n";
}
print "</center><br>";
// выводим все сообщения в цикле
for ($i = $start; $i < $count; $i++)
{
$entry = $names[$i];
$data = file("../wap/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<a href=\\2 target=_blank>\\2</a>\\3",$msg);
$msg = str_replace("[br]","<br>",$msg);
$msg = str_replace(";)","<img src='../wap/img/bb_icons/smile.gif'>",$msg);
$msg = str_replace(":dance:","<img src='../wap/img/bb_icons/4.gif'>",$msg);
$msg = str_replace(";(","<img src='../wap/img/bb_icons/2.gif'>",$msg);
$msg = str_replace(":lol:","<img src='../wap/img/bb_icons/8.gif'>",$msg);
$msg = str_replace(":ok:","<img src='../wap/img/bb_icons/9.gif'>",$msg);
$msg = str_replace(":shit:","<img src='../wap/img/bb_icons/13.gif'>",$msg);
$msg = str_replace(":star:","<img src='../wap/img/bb_icons/star.gif'>",$msg);
/////////////////////////
echo "<table border=0 width=100%>";
echo "<tr>";
// если гость - нет ссылки на профиль, если зареганый - есть
$dir = opendir ("../wap/lcl/prof/");
$fear=0;
while ( $file = readdir ($dir))
		{
if (( $file != ".") && ($file != ".."))
{
//echo "<br>----$file<br>";
if ($name!=$file)
	{
$fear=$fear;
	}
else
	{
$fear++;
	}
}
		}
closedir ($dir);
if ($fear>0) { echo "<td width=100%><div class=a><a href='../usr/prosmotr.php?log_pr=$name' class=cool>$name</a>"; }
else { echo "<td width=100%><div class=a>$name"; }
////////// проверка на админа ////////
if ($_SESSION)
{
$files_array = file("../wap/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='gb_del.php?date=$date' class=cool>[del]</a>");
	}
}
echo "</div></td>";
echo "</tr>";
echo "<tr>";
echo "<td width=100%>$msg</td>";
echo "<tr>";
echo "</table>";
}
/////////////////////////
print "<center>";
if ($start != 0)
{
print "<A href=index.php?start=".($start - $mgs_gb)."> Предыдущие </A>";
}
if ($count1 > $start + $mgs_gb)
{
print "<A href=index.php?start=".($start + $mgs_gb)."> Следующие </A> \n";
}
print "</center>";
?>

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

<?php
$f=fopen("../wap/lcl/panel2.dt","r");
$ifda=fgets($f);
$ifda=trim($ifda);
if ($ifda==1)
{
echo "</td>";
echo "<td width=100% valign=_top>";
require_once"../panel/panel2q.php";
}

require_once"../tmpl/dw.php";
?>