<?php
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //// . ... ...... .. ...... .. .. /////
// /// ...MM# .MMMMa. ..MMMMMMMMMMMe ..., ..MMMN, .dMMMMMMMMMN., .MMMN, ...., ..dMMMe ////
// // ..ggMMMMMM= .NMMMMMMM& .JgMMMMMMMMMMMMMMMNa. ...gMMHH=??` qMMMMMMMN. .NMMMMMMMMMMMMMNga. .JMMMMM% ..JgMHH5??! .MMMMMMMNp ////
// // JMMMYWMMMY`.d#= MMMMMM# .dMMM""" .+MM#WMMMMMM: .JMMY= .MMMMMMMMe 7"""""MMMMMMMMMMMMMb .JMMMMMM% .JdM#"! dMMMMMMMN, ////
// // ` .MMMMndM#^ .MMMMM# ?^` .dM#^ `MMMM#! .MMM9` ?MMMMMMM# ``7MMMMMMM@ ``MMMM#` .jMM#^ MMMMMMMM% ////
// // JMMMMNMM@' TMMMM@ .M#^ .gMMMM@' JMMM= `7MMMMM# 7MMMMM@ MMM= .MMM#' 7TMMMMM% ////
// // .dMMMMMMD .MMMM: .#^ ..MMMM#"! ..MMMM: .MMMM: ?MMMM@ .dM" .MMMM@ MMMM# ////
// // .MMMMMM\ .Jm....MMM\ .JMNgMMMM5?` .MMMMM& .MMMY` MMMM@ .JMMY` JMMMMN. .MMMB! ////
// // JMMMMM#= .JMMMMMMM@ .MMMMm, .MMMMM#. .MMM= .MM#= .JMM= JMMMMM| JMMY` ////
// // .MMMMMM\ TWMMMMMM= Q., .+MMMMMMMNa. .WMMMMMNa. .+MM= .MM#.+MMP ?MMMMMMN, .MM@` ////
// // JMMMMM\ JMMM" .MMMMggY` JMMMMMMNg. .WMMMMMMNg,.. .JMM" .MMMMM#^ ?MMMMMMMNg.. ..MM@' ////
// // .MMMMM@ ?YMMD` `HMMMM# TTMMMMMMMMMNNNNNMB5` .MMMMB! `"MMMMMMMMMNNNNNNM"^` ////
// // .gMMMM= ?MM#! `?MMMMMMMMMMY! .MMB! ?TMMMMMMMMMB?! ////
// // = ////
// // /////
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// // Сервис гостевых книг Автор ТСМ http://provo.spb.ru/ //////
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
error_reporting(0);
if (isset($GBname)) {
setcookie('GBnameCOOKIE', $GBname, time() + 60 * 60 * 24 * 60);
$GBnameCOOKIE = $GBname;
}
if (isset($GBurl)) {
setcookie('GBurlCOOKIE', $GBurl, time() + 60 * 60 * 24 * 60);
$GBurlCOOKIE = $GBurl;
}
if (isset($pass)) {
setcookie('pass', $pass, time() + 60 * 60 * 24 * 60);
}
if ($mod == 'exit') {
setcookie('pass', '');
$pass = '';
$mod = '';
}
if ($mod == 'setup' && $cat == 'access' && isset($sub) && $newadminpass != '') {
setcookie('pass', $newadminpass, time() + 60 * 60 * 24 * 60);
}
if ($mod == 'repas') {
setcookie('pass', '');
$pass = '';
}
if (isset($id) && $passwordgbN != '') {
setcookie('passwordgb', $passwordgbN, time() + 60 * 60 * 24 * 60);
$passwordgb = $passwordgbN;
}
if($mod=='delcookie'){
setcookie('GBnameCOOKIE','');
setcookie('GBurlCOOKIE','');
setcookie('pass', '');
setcookie('passwordgb', '');
$mod='';
}
header("Content-type:application/xhtml+xml; charset=utf-8");
if (!isset($id)) {
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xml:lang="ru" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>
Сервис гостевых книг
</title>
<link rel="icon" href="icons/001.ico" type="image/ico" />
<style type="text/css">
* {padding: 0; margin: 0;}
body{font-size: 12px; font-family: arial; line-height: 16px; background: #000000; color: #ff0000;}
a, a:link, a:visited, a img {text-decoration: none; border: none; color: #ff0000;}
#header{background: #b00000; text-align: center;}
/*#nav-main ul, #nav-main ul li {list-style: none inside;}*/
#nav-main div, #nav-main div a {display: block; height: 20px; line-height: 20px; background: #500000; margin: 2px 0; }
/*#nav-main div a img{line-height: 16px;}*/
#nav-main div a{padding: 0 5px; color: #ff0000;}
#nav-main div a:hover, #nav-main div a:active, #nav-main div a:focus{color: #ff9999; background: #900000; outline: none;}
</style>
</head>
<body>';
print ' <div id="header">
<img src="./logo.png" alt="' . $_SERVER['SERVER_NAME'] . '"/>
</div>
<div id="nav-main">';
if (!isset($mod) or $mod=='') {
print '
<div><a href="./?mod=reg"><img src="./icons/star.png" alt="star"/>Регистрация</a></div>
<div><a href="./?mod=top"><img src="./icons/star.png" alt="star"/>Рейтинг</a></div>
<hr/>
<form action="./" method="get">
<p>Логин:</p>
<p><input name="id"/></p>
<p>Пароль:</p>
<p><input name="pass" type="password"/></p>
<p><input type="submit" value="Вход"/></p>
</form>
<div><a href="./?mod=delcookie">[Удалить cookies] (если проблемы с авторизацией)</a></div>
<div><a href="./?mod=repas">[Забыли пароль?]</a></div>
<div><a href="../">[Главная]</a></div>
';
}
if ($mod == 'top') {
$dir = opendir('data');
while ($file = readdir($dir)) {
if ($file != '..' && $file != '.') {
$name = explode('.', $file);
$name = $name[0];
$tmp = file('data/' . $file);
$count = count($tmp)-1;
$array[] = $count . '---' . $name;
}
}
if (isset($array)) {
usort($array, strnatcmp);
$n = 1 + 10 * $page;
for($i = count($array)-1-10 * $page;$i > count($array)-11-10 * $page;$i--) {
if (trim($array[$i]) != '') {
$tmp = explode('---', $array[$i]);
print '<p>'.$n . '. <a href="./?id=' . $tmp[1] . '">' . $tmp[1] . '</a> - ' . $tmp[0] . ' сообщ.</p>';
$n = $n + 1;
}
}
if (count($array)-11-10 * $page > 0) {
$next = $page + 1;
print '
<div><a href="./?mod=top&page=' . $next . '">далее</a></div>
';
}
if ($page > 0) {
$back = $page-1;
print '
<div><a href="./?mod=top&page=' . $back . '">назад</a></div>
';
}
print '
<div><a href="./">[Сервис гостевых]</a></div>
<div><a href="../">[Главная]</a></div>';
} else {
print 'Нет активных гостевых!
<div><a href="./">[Сервис гостевых]</a></div>
<div><a href="../">[Главная]</a></div>';
}
}
if ($mod == 'repas') {
if (!isset($log)) {
print '<p>Здесь вы можете сгенерировать пароль. Новый пароль будет выслан на e-mail, указанный при регистрации!</p>
Введите ваш логин (id):
<form action="./?mod=repas" method="post">
<p><input name="log"/></p>
<p><input type="submit" value="Отправить" name="sub"/></p>
</form>';
} else {
if (file_exists('users/' . $log . '.php')) {
include 'users/' . $log . '.php';
if ($emailAdmin != '') {
function genPwd($lenght = 10)
{
$pass000 = str_repeat(' ', $lenght);
return preg_replace_callback('#.#', 'randSymbol', $pass000);
}
function randSymbol()
{
$str = 'qwertyuiopasdfghjklzxcvbnm0123456789';
return $str[mt_rand(0, strlen($str)-1)];
}
$code = genPwd(8);
$newadminpass = md5($code);
$file = fopen('users/' . $log . '.php', 'w');
fwrite($file, '<?php
$passwordAdmin="' . $newadminpass . '";
$emailAdmin="' . $emailAdmin . '";
$nickAdmin="' . $nickAdmin . '";
$indexPage="' . $indexPage . '";
$passGB="' . $passGB . '";
$bodyBack="' . $bodyBack . '";
$bodyColor="' . $bodyColor . '";
$aColor="' . $aColor . '";
$pBorder="' . $pBorder . '";
$headerBack="' . $headerBack . '";
$footerBack="' . $footerBack . '";
$footerColor="' . $footerColor . '";
$mainBack="' . $mainBack . '";
$mainA="' . $mainA . '";
$focusColor="' . $focusColor . '";
$focusBack="' . $focusBack . '";
$messPage="' . $messPage . '";
$timeSdvig="' . $timeSdvig . '";
$titlebook="' . $titlebook . '";
$iconbook="' . $iconbook . '";
$logoGB="' . $logoGB . '";
$headerGB="' . $headerGB . '";
?>');
fclose($file);
include 'utf-win.php';
mail($emailAdmin, utf_win('Новый пароль'), utf_win('Восстановление пароля на сайте '.$_SERVER['SERVER_NAME'].'
Данные для входа:
Логин - ' . $log . '
Пароль - ' . $code . '
Удачи!'), 'From:noreply');
print 'Новый пароль выслан на ' . $emailAdmin . '
<div><a href="./">[Назад]</a></div>
';
} else {
print 'Для ID ' . $log . ' не указан e-mail!!!';
}
} else {
print 'Гостевая с ID ' . $log . ' не найдена!';
}
}
print '
<div><a href="./">[Сервис гостевых]</a></div>
<div><a href="../">[Главная]</a></div>';
}
if ($mod == 'reg') {
if (isset($sub)) {
if ($name == '') {
$error = 'Введите логин!!!';
} else {
if (file_exists('users/' . $name . '.php')) {
$error = 'Гостевая с логином ' . $name . ' уже существует! Выберите другой!';
} else {
if ($pas != $pas2 or $pas == '') {
$error = 'Пароли не совпадают или не введены!';
} else {
$file = fopen('users/' . $name . '.php', 'w');
fwrite($file, '<?php
$passwordAdmin="' . md5($pas) . '";
$emailAdmin="' . $mail . '";
$nickAdmin="' . $nick . '";
$indexPage="' . $url . '";
$bodyBack="#000000";
$bodyColor="#ff0000";
$aColor="#aa1111";
$pBorder="#b1bcd3";
$headerBack="#aa0000";
$footerBack="#6b8cba";
$footerColor="#ffffff";
$mainBack="#220000";
$mainA="#bbbbbb";
$focusColor="#ffffff";
$focusBack="#7c0000";
$messPage="6";
$timeSdvig="0";
$logoGB="./logo.png";
$headerGB="Гостевая";
?>');
fclose($file);
include 'utf-win.php';
mail($mail, utf_win('Регистрация гостевой'), utf_win('Ваш e-mail был указан при регистрации гостевой книги на сайте '.$_SERVER['SERVER_NAME'].'
Данные для входа:
Логин - ' . $name . '
Пароль - ' . $pas . '
Ссылка для автологина: http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?id=' . $name . '&pass=' . $pas . '
Удачи!'), 'From:noreply');
$successReg = 'OK';
if (file_exists('users/' . $name . '.php')) {
print '
<p>Регистрация завершена!</p>
<p>Данные для входа:</p>
<p>Логин - ' . $name . '</p>
<p>Пароль - ' . $pas . '</p>
<p>Ссылка на гостевую: http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?id=' . $name . '</p>
<p><textarea rows="4" cols="50">http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?id=' . $name . '</textarea></p>
<p>Ссылка для автологина: http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?id=' . $name . '&pass=' . $pas . '</p>
<textarea rows="4" cols="50">http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'?id=' . $name . '&pass=' . $pas . '</textarea>
';
}
}
}
}
}
if (!isset($successReg)) {
print '<b>Регистрация гостевой</b>';
if (isset($error)) {
print '
<p>ОШИБКА:' . $error.'</p>';
}
print '
<p>
Указывайте реальный e-mail, на него будет выслан пароль, если вы его забудете!
</p>
<form action="./?mod=reg" method="post">
<p>Введите логин:</p>
<p><input type="text" name="name" value="' . $name . '"/></p>
<p>Введите пароль:</p>
<p><input type="password" name="pas" value="' . $pas . '"/></p>
<p>Повторите пароль:</p>
<p><input type="password" name="pas2" value="' . $pas2 . '"/></p>
<p>Введите ник:</p>
<p><input type="text" name="nick" value="' . $nick . '"/></p>
<p>Введите e-mail:</p>
<p><input type="text" name="mail" value="' . $mail . '"/></p>
<p>Введите адрес сайта:</p>
<p><input type="text" name="url" value="' . $url . '"/></p>
<p><input type="submit" name="sub" value="Регистрировать!"/></p>
</form>';
}
print '
<div><a href="./">[Сервис гостевых]</a></div>
<div><a href="../">[Главная]</a></div>
';
}
print '
</div>
</body>
</html>
';
}
if (isset($id)) {
if (file_exists('users/' . $id . '.php')) {
include 'users/' . $id . '.php';
if ($passGB == '' or $passGB == md5($passwordgb) or $passwordAdmin == md5($pass)) {
if ($titlebook != '') {
$title = $titlebook;
} else {
$title = $_SERVER['SERVER_NAME'];
}
if ($iconbook == '') {
$iconbook = './icons/001.ico';
}
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xml:lang="ru" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>
' . $title . '
</title>
<link rel="icon" href="' . $iconbook . '" type="image/ico" />
<style type="text/css">
* {padding: 0; margin: 0;}
body{font-size: 12px; font-family: arial; line-height: 16px; background: '.$bodyBack.'; color: '.$bodyColor.';}
a, a:link, a:visited, a img {text-decoration: none; border: none; color: '.$aColor.';}
#header{background: '.$headerBack.'; text-align: center;}
/*#nav-main ul, #nav-main ul li {list-style: none inside;}*/
#nav-main div, #nav-main div a {display: block; height: 20px; line-height: 20px; background: '.$mainBack.'; margin: 2px 0; }
/*#nav-main div a img{line-height: 16px;}*/
#nav-main div a{padding: 0 5px; color:'.$mainA.';}
#nav-main div a:hover, #nav-main div a:active, #nav-main div a:focus{color: '.$focusColor.'; background: '.$focusBack.'; outline: none;}
</style>
</head>
<body>';
print ' <div id="header">';
if ($logoGB != '') {
print '<img src="' . $logoGB . '" alt="LOGO"/>';
}
if ($headerGB != '' && $logoGB != '') {
print '<hr/>';
}
if ($headerGB != '') {
print $headerGB;
}
print ' </div>
<div id="nav-main">';
if ($mod == 'smiles') {
print '
<p>В своих сообщения вы можете использовать смайлы:</p>';
if ($page == '') {
print '
<p><img src="smiles/angel.png" alt=""/> - *angel*</p>
<p><img src="smiles/bad.gif" alt=""/> - *bad*</p>
<p><img src="smiles/biggrin.gif" alt=""/> - *grin*</p>
<p><img src="smiles/blum.gif" alt=""/> - *blum*</p>
<p><img src="smiles/blush.gif" alt=""/> - *blush*</p>
<p><img src="smiles/boian.png" alt=""/> - *boian*</p>
<p><img src="smiles/cray.gif" alt=""/> - *cray*</p>
<p><img src="smiles/crazy.gif" alt=""/> - *crazy*</p>
<p><img src="smiles/dance.gif" alt=""/> - *dance*</p>
<p><img src="smiles/diablo.gif" alt=""/> - *diablo*</p>
<p><img src="smiles/dirol.gif" alt=""/> - *dirol*</p>
<p>[1]<a href="./?id=' . $id . '&page=1&mod=smiles">[2]</a><a href="./?id=' . $id . '&page=2&mod=smiles">[3]</a></p>';
}
if ($page == 1) {
print '
<p><img src="smiles/drinks.gif" alt=""/> - *drinks*</p>
<p><img src="smiles/fool.gif" alt=""/> - *fool*</p>
<p><img src="smiles/give_rose.gif" alt=""/> - *rose*</p>
<p><img src="smiles/good.gif" alt=""/> - *good*</p>
<p><img src="smiles/kiss_mini.gif" alt=""/> - *kiss*</p>
<p><img src="smiles/kut.png" alt=""/> - *kut*</p>
<p><img src="smiles/man_in_love.gif" alt=""/> - *love*</p>
<p><img src="smiles/mocking.gif" alt=""/> - *mocking*</p>
<p><img src="smiles/music.gif" alt=""/> - *music*</p>
<p><img src="smiles/nea.gif" alt=""/> - *nea*</p>
<p><img src="smiles/pardon.gif" alt=""/> - *pardon*</p>
<p><a href="./?id=' . $id . '&page=&mod=smiles">[1]</a>[2]<a href="./?id=' . $id . '&page=2&mod=smiles">[3]</a></p>';
}
if ($page == 2) {
print '
<p><img src="smiles/rofl.gif" alt=""/> - *rofl*</p>
<p><img src="smiles/rolleyes.gif" alt=""/> - *rolleyes*</p>
<p><img src="smiles/sad.gif" alt=""/> - *sad*</p>
<p><img src="smiles/scratch_one-s_head.gif" alt=""/> - *scratch*</p>
<p><img src="smiles/shok.gif" alt=""/> - *shok*</p>
<p><img src="smiles/shout.gif" alt=""/> - *shout*</p>
<p><img src="smiles/smile.gif" alt=""/> - *smile*</p>
<p><img src="smiles/unknw.gif" alt=""/> - *unknw*</p>
<p><img src="smiles/wacko2.gif" alt=""/> - *wacko*</p>
<p><img src="smiles/wink.gif" alt=""/> - *wink*</p>
<p><img src="smiles/yahoo.gif" alt=""/> - *yahoo*</p>
<p><a href="./?id=' . $id . '&page=&mod=smiles">[1]</a><a href="./?id=' . $id . '&page=1&mod=smiles">[2]</a>[3]</p>
';
}
print '
<div><a href="./?id=' . $id . '&mod=add">[Написать]</a></div>
<div><a href="./?id=' . $id . '">[К гостевой]</a></div>
';
}
if ($mod == 'add') {
// ////////////////// добавление сообщений
if (md5($pass) == $passwordAdmin) {
$GBnameCOOKIE = $nickAdmin;
$GBurlCOOKIE = $indexPage;
}
if (!isset($sub) or $GBname == '' or $GBtxt == '') {
print '<form action="./?id=' . $id . '&mod=add" method="post">
<p>Имя:</p><p><input name="GBname" value="' . $GBnameCOOKIE . '"/></p>
<p>URL:</p><p><input name="GBurl" value="' . $GBurlCOOKIE . '"/></p>
<p>Сообщение:</p><p><textarea name="GBtxt" rows="4" cols="20"></textarea></p>
<p><input type="submit" name="sub" value="Отправить"/></p>
</form>
<div><a href="./?id=' . $id . '&mod=smiles">[Справка по смайлам]</a></div>
<div><a href="./?id=' . $id . '">[Назад]</a></div>
';
} else {
$agent = explode('/', $_SERVER['HTTP_USER_AGENT']);
$agent = $agent[0];
$arr1 = array('*angel*',
'*bad*',
'*grin*',
'*blum*',
'*blush*',
'*boian*',
'*cray*',
'*crazy*',
'*dance*',
'*diablo*',
'*dirol*',
'*drinks*',
'*fool*',
'*rose*',
'*good*',
'*kiss*',
'*kut*',
'*love*',
'*mocking*',
'*music*',
'*nea*',
'*pardon*',
'*rofl*',
'*rolleyes*',
'*sad*',
'*scratch*',
'*shok*',
'*shout*',
'*smile*',
'*unknw*',
'*wacko*',
'*wink*',
'*yahoo*',
'
');
$arr2 = array('<img src="smiles/angel.png" alt=""/>',
'<img src="smiles/bad.gif" alt=""/>',
'<img src="smiles/biggrin.gif" alt=""/>',
'<img src="smiles/blum.gif" alt=""/>',
'<img src="smiles/blush.gif" alt=""/>',
'<img src="smiles/boian.png" alt=""/>',
'<img src="smiles/cray.gif" alt=""/>',
'<img src="smiles/crazy.gif" alt=""/>',
'<img src="smiles/dance.gif" alt=""/>',
'<img src="smiles/diablo.gif" alt=""/>',
'<img src="smiles/dirol.gif" alt=""/>',
'<img src="smiles/drinks.gif" alt=""/>',
'<img src="smiles/fool.gif" alt=""/>',
'<img src="smiles/give_rose.gif" alt=""/>',
'<img src="smiles/good.gif" alt=""/>',
'<img src="smiles/kiss_mini.gif" alt=""/>',
'<img src="smiles/kut.png" alt=""/>',
'<img src="smiles/man_in_love.gif" alt=""/>',
'<img src="smiles/mocking.gif" alt=""/>',
'<img src="smiles/music.gif" alt=""/>',
'<img src="smiles/nea.gif" alt=""/>',
'<img src="smiles/pardon.gif" alt=""/>',
'<img src="smiles/rofl.gif" alt=""/>',
'<img src="smiles/rolleyes.gif" alt=""/>',
'<img src="smiles/sad.gif" alt=""/>',
'<img src="smiles/scratch_one-s_head.gif" alt=""/>',
'<img src="smiles/shok.gif" alt=""/>',
'<img src="smiles/shout.gif" alt=""/>',
'<img src="smiles/smile.gif" alt=""/>',
'<img src="smiles/unknw.gif" alt=""/>',
'<img src="smiles/wacko2.gif" alt=""/>',
'<img src="smiles/wink.gif" alt=""/>',
'<img src="smiles/yahoo.gif" alt=""/>',
'<p></p>');
$time = time() + $timeSdvig * 60 * 60;
$date2 = date('H:i:s', (int) (trim($time)));
$date1 = date('d.m.Y', (int) (trim($time)));
$file = fopen('data/' . $id . '.dat', 'a');
fwrite($file, '
' . $GBname . '{|||}' . $date1 . ' ' . $date2 . '{|||}' . str_replace($arr1, $arr2, htmlspecialchars($GBtxt)) . '{|||}' . $agent . '{|||}' . $_SERVER['HTTP_USER_AGENT'] . '{|||}' . $_SERVER['HTTP_X_FORWARDED_FOR'] . '{|||}' . $_SERVER['HTTP_REFERER'] . '{|||}' . htmlspecialchars($GBurl));
fclose($file);
$mod = '';
}
}
if ($mod == 'del') {
if (md5($pass) == $passwordAdmin) {
$file = file('data/' . $id . '.dat');
$fopen = fopen('data/' . $id . '.dat', 'w');
for($i = 0;$i < count($file);$i++) {
if ($i != $mes) {
$dat = explode('{|||}', $file[$i]);
if ($dat[0] != '' && $dat[1] != '' && $dat[2] != '') {
fwrite($fopen, '
' .
trim($file[$i]));
}
}
}
fclose($fopen);
$mod = '';
} else {
print 'А вам сюда нельзя!!! =)';
}
}
if ($mod == 'edit') {
if (md5($pass) == $passwordAdmin) {
if (!isset($sub)) {
$file = file('data/' . $id . '.dat');
$dat = explode('{|||}', $file[$mes]);
print '
<form action="./?id=' . $id . '" method="post">
<p>Имя:</p><p> <input name="nameedit" value="' . trim($dat[0]) . '"/></p>
<p>Дата:</p> <p> <input name="dateedit" value="' . trim($dat[1]) . '"/></p>
<p>Сообщение:</p><p> <textarea rows="4" cols="20" name="txtedit">' . htmlspecialchars(trim($dat[2])) . '</textarea></p>
<p>Браузер:</p> <p> <input name="bredit" value="' . trim($dat[3]) . '"/></p>
<p>User-Agent:</p> <p> <input name="uaedit" value="' . trim($dat[4]) . '"/></p>
<p>IP:</p> <p> <input name="ipedit" value="' . trim($dat[5]) . '"/></p>
<p>URL:</p> <p> <input name="urledit" value="' . htmlspecialchars(trim($dat[7])) . '"/></p>
<p>Ответ:</p> <p> <textarea rows="4" cols="20" name="otedit">' . htmlspecialchars(trim($dat[8])) . '</textarea>
<input name="mod" type="hidden" value="edit"/>
<input name="mes" type="hidden" value="' . $mes . '"/></p>
<p><input name="sub" type="submit" value="Сохранить"/></p>
</form>
<div><a href="./?id=' . $id . '">[Назад]</a></div>
';
} else {
$file = file('data/' . $id . '.dat');
$fopen = fopen('data/' . $id . '.dat', 'w');
for($i = 0;$i < count($file);$i++) {
if ($i == $mes) {
$arr1 = array('*angel*',
'*bad*',
'*grin*',
'*blum*',
'*blush*',
'*boian*',
'*cray*',
'*crazy*',
'*dance*',
'*diablo*',
'*dirol*',
'*drinks*',
'*fool*',
'*rose*',
'*good*',
'*kiss*',
'*kut*',
'*love*',
'*mocking*',
'*music*',
'*nea*',
'*pardon*',
'*rofl*',
'*rolleyes*',
'*sad*',
'*scratch*',
'*shok*',
'*shout*',
'*smile*',
'*unknw*',
'*wacko*',
'*wink*',
'*yahoo*',
'
');
$arr2 = array('<img src="smiles/angel.png" alt=""/>',
'<img src="smiles/bad.gif" alt=""/>',
'<img src="smiles/biggrin.gif" alt=""/>',
'<img src="smiles/blum.gif" alt=""/>',
'<img src="smiles/blush.gif" alt=""/>',
'<img src="smiles/boian.png" alt=""/>',
'<img src="smiles/cray.gif" alt=""/>',
'<img src="smiles/crazy.gif" alt=""/>',
'<img src="smiles/dance.gif" alt=""/>',
'<img src="smiles/diablo.gif" alt=""/>',
'<img src="smiles/dirol.gif" alt=""/>',
'<img src="smiles/drinks.gif" alt=""/>',
'<img src="smiles/fool.gif" alt=""/>',
'<img src="smiles/give_rose.gif" alt=""/>',
'<img src="smiles/good.gif" alt=""/>',
'<img src="smiles/kiss_mini.gif" alt=""/>',
'<img src="smiles/kut.png" alt=""/>',
'<img src="smiles/man_in_love.gif" alt=""/>',
'<img src="smiles/mocking.gif" alt=""/>',
'<img src="smiles/music.gif" alt=""/>',
'<img src="smiles/nea.gif" alt=""/>',
'<img src="smiles/pardon.gif" alt=""/>',
'<img src="smiles/rofl.gif" alt=""/>',
'<img src="smiles/rolleyes.gif" alt=""/>',
'<img src="smiles/sad.gif" alt=""/>',
'<img src="smiles/scratch_one-s_head.gif" alt=""/>',
'<img src="smiles/shok.gif" alt=""/>',
'<img src="smiles/shout.gif" alt=""/>',
'<img src="smiles/smile.gif" alt=""/>',
'<img src="smiles/unknw.gif" alt=""/>',
'<img src="smiles/wacko2.gif" alt=""/>',
'<img src="smiles/wink.gif" alt=""/>',
'<img src="smiles/yahoo.gif" alt=""/>',
'<p></p>');
$file[$i] = htmlspecialchars($nameedit) . '{|||}' . $dateedit . '{|||}' . str_replace('
', '<p></p>', $txtedit) . '{|||}' . $bredit . '{|||}' . $uaedit . '{|||}' . $ipedit . '{|||}{|||}' . htmlspecialchars($urledit) . '{|||}' . str_replace($arr1, $arr2, $otedit) . '{|||}';
}
$dat = explode('{|||}', $file[$i]);
if ($dat[0] != '' && $dat[1] != '' && $dat[2] != '') {
fwrite($fopen, '
' . trim($file[$i]));
}
}
fclose($fopen);
$mod = '';
}
} else {
print 'А вам сюда нельзя!!! =)';
}
}
if ($mod == 'setup') {
if (md5($pass) == $passwordAdmin) {
if ($cat == '') {
print '
<div><a href="./?id=' . $id . '&mod=setup&cat=access">[Настройки доступа]</a></div>
<div><a href="./?id=' . $id . '&mod=setup&cat=color">[Настройки цвета]</a></div>
<div><a href="./?id=' . $id . '&mod=setup&cat=other">[Другие настройки]</a></div>
<div><a href="./?id=' . $id . '&mod=setup&cat=purge">[Очистка гостевой]</a></div>
';
}
if ($cat == 'purge') {
if (isset($sub)) {
$file = file('data/' . $id . '.dat');
$start = count($file) - $lastmess;
$fopen = fopen('data/' . $id . '.dat', 'w');
if ($start < 0) {
$start = 0;
}
for($i = $start;$i < count($file);$i++) {
if (trim($file[$i]) != '') {
fwrite($fopen, '
' . trim($file[$i]));
}
}
fclose($fopen);
print 'Очистка гостевой завершена!!!
<div><a href="./?id=' . $id . '&mod=setup">[К настройкам]</a></div>';
} else {
if ($purge == 'all') {
unlink('data/' . $id . '.dat');
print 'Все сообщения удалены!!!';
}
print '<div><a href="./?id=' . $id . '&mod=setup&cat=purge&purge=all">[ОЧИСТИТЬ ПОЛНОСТЬЮ]</a></div>';
print '
<form action="./?id=' . $id . '&mod=setup&cat=purge" method="post">
<p>Оставить <input name="lastmess" size="2" value="20"/> последних сообщений</p>
<p>
<input type="submit" name="sub" value="Очистить"/></p>
</form>
';
print '<div><a href="./?id=' . $id . '&mod=setup">[К настройкам]</a></div>';
}
}
if ($cat == 'color') {
if (isset($sub)) {
$file = fopen('users/' . $id . '.php', 'w');
fwrite($file, '<?php
$passwordAdmin="' . $passwordAdmin . '";
$emailAdmin="' . $emailAdmin . '";
$nickAdmin="' . $nickAdmin . '";
$indexPage="' . $indexPage . '";
$passGB="' . $passGB . '";
$bodyBack="' . $newbodyBack . '";
$bodyColor="' . $newbodyColor . '";
$aColor="' . $newaColor . '";
$pBorder="' . $newpBorder . '";
$headerBack="' . $newheaderBack . '";
$footerBack="' . $newfooterBack . '";
$footerColor="' . $newfooterColor . '";
$mainBack="' . $newmainBack . '";
$mainA="' . $newmainA . '";
$focusColor="' . $newfocusColor . '";
$focusBack="' . $newfocusBack . '";
$messPage="' . $messPage . '";
$timeSdvig="' . $timeSdvig . '";
$titlebook="' . $titlebook . '";
$iconbook="' . $iconbook . '";
$logoGB="' . $logoGB . '";
$headerGB="' . $headerGB . '";
?>');
fclose($file);
include 'users/' . $id . '.php';
print 'Настройки сохранены!!!';
}
print '
<form action="./?id=' . $id . '&mod=setup&cat=color" method="post">
<p>Фон страницы:</p>
<p><input name="newbodyBack" value="' . $bodyBack . '"/></p>
<p>Текст страницы:</p>
<p><input name="newbodyColor" value="' . $bodyColor . '"/></p>
<p>Ссылки страницы:</p>
<p><input name="newaColor" value="' . $aColor . '"/></p>
<p>Бордюр:</p>
<p><input name="newpBorder" value="' . $pBorder . '"/></p>
<p>Фон верха/низа страницы:</p>
<p><input name="newheaderBack" value="' . $headerBack . '"/>
<input name="newfooterBack" type="hidden" value="' . $footerBack . '"/>
<input name="newfooterColor" type="hidden" value="' . $footerColor . '"/></p>
<p>Фон блока:</p>
<p><input name="newmainBack" value="' . $mainBack . '"/></p>
<p>Ссылки блока:</p>
<p><input name="newmainA" value="' . $mainA . '"/></p>
<p>Ссылка в фокусе:</p>
<p><input name="newfocusColor" value="' . $focusColor . '"/></p>
<p>Фон ссылки в фокусе:</p>
<p><input name="newfocusBack" value="' . $focusBack . '"/></p>
<p><input type="submit" name="sub" value="Сохранить"/></p>
</form>
';
print '<div><a href="./?id=' . $id . '&mod=setup">[К настройкам]</a></div>';
}
if ($cat == 'other') {
if (isset($sub)) {
$file = fopen('users/' . $id . '.php', 'w');
fwrite($file, '<?php
$passwordAdmin="' . $passwordAdmin . '";
$emailAdmin="' . $emailAdmin . '";
$nickAdmin="' . $nickAdmin . '";
$indexPage="' . $newindexPage . '";
$passGB="' . $passGB . '";
$bodyBack="' . $bodyBack . '";
$bodyColor="' . $bodyColor . '";
$aColor="' . $aColor . '";
$pBorder="' . $pBorder . '";
$headerBack="' . $headerBack . '";
$footerBack="' . $footerBack . '";
$footerColor="' . $footerColor . '";
$mainBack="' . $mainBack . '";
$mainA="' . $mainA . '";
$focusColor="' . $focusColor . '";
$focusBack="' . $focusBack . '";
$messPage="' . $newmessPage . '";
$timeSdvig="' . $newtimeSdvig . '";
$titlebook="' . $newtitlebook . '";
$iconbook="' . $newiconbook . '";
$logoGB="' . $newlogoGB . '";
$headerGB="' . $newheaderGB . '";
?>');
fclose($file);
include 'users/' . $id . '.php';
print 'Настройки сохранены!!!';
}
print '
<form action="./?id=' . $id . '&mod=setup&cat=other" method="post">
<p>Главная страница:</p>
<p><input name="newindexPage" value="' . $indexPage . '"/></p>
<p>Логотип:</p>
<p><input name="newlogoGB" value="' . $logoGB . '"/></p>
<p>Текст сверху:</p>
<p><input name="newheaderGB" value="' . $headerGB . '"/></p>
<p>Сообщений на странице:</p>
<p><input name="newmessPage" value="' . $messPage . '"/></p>
<p>Смещение часов:</p>
<p><input name="newtimeSdvig" value="' . $timeSdvig . '"/></p>
<p>Заголовок:</p>
<p><input name="newtitlebook" value="' . $titlebook . '"/></p>
<p>Иконка:</p>';
for($i = 1;$i <= 6;$i++) {
if ($iconbook == './icons/00' . $i . '.ico') {
print '<p><input type="radio" name="newiconbook" value="./icons/00' . $i . '.ico" checked="checked"/> <img src="./icons/00' . $i . '.ico" alt="00' . $i . '"/></p>
';
} else {
print '<p><input type="radio" name="newiconbook" value="./icons/00' . $i . '.ico"/> <img src="./icons/00' . $i . '.ico" alt="00' . $i . '"/></p>
';
}
}
print '<p><input type="radio" name="newiconbook" value="my"/> Своя: <input name="myicon" value="' . $iconbook . '"/></p>
<p><input type="submit" name="sub" value="Сохранить"/></p>
</form>
';
print '<div><a href="./?id=' . $id . '&mod=setup">[К настройкам]</a></div>';
}
if ($cat == 'access') {
if (isset($sub)) {
$file = fopen('users/' . $id . '.php', 'w');
if ($newadminpass == '') {
$newadminpass = $passwordAdmin;
} else {
$newadminpass = md5($newadminpass);
}
if ($newgbpass == '') {
$newgbpass = $passGB;
} else {
$newgbpass = md5($newgbpass);
}
fwrite($file, '<?php
$passwordAdmin="' . $newadminpass . '";
$emailAdmin="' . $newadminmail . '";
$nickAdmin="' . $newadminnick . '";
$indexPage="' . $indexPage . '";
$passGB="' . $newgbpass . '";
$bodyBack="' . $bodyBack . '";
$bodyColor="' . $bodyColor . '";
$aColor="' . $aColor . '";
$pBorder="' . $pBorder . '";
$headerBack="' . $headerBack . '";
$footerBack="' . $footerBack . '";
$footerColor="' . $footerColor . '";
$mainBack="' . $mainBack . '";
$mainA="' . $mainA . '";
$focusColor="' . $focusColor . '";
$focusBack="' . $focusBack . '";
$messPage="' . $messPage . '";
$timeSdvig="' . $timeSdvig . '";
$titlebook="' . $titlebook . '";
$iconbook="' . $iconbook . '";
$logoGB="' . $logoGB . '";
$headerGB="' . $headerGB . '";
?>');
fclose($file);
include 'users/' . $id . '.php';
print 'Настройки сохранены!!!';
}
if ($gbpas == 'del') {
$file = fopen('users/' . $id . '.php', 'w');
fwrite($file, '<?php
$passwordAdmin="' . $passwordAdmin . '";
$emailAdmin="' . $emailAdmin . '";
$nickAdmin="' . $nickAdmin . '";
$indexPage="' . $indexPage . '";
$passGB="";
$bodyBack="' . $bodyBack . '";
$bodyColor="' . $bodyColor . '";
$aColor="' . $aColor . '";
$pBorder="' . $pBorder . '";
$headerBack="' . $headerBack . '";
$footerBack="' . $footerBack . '";
$footerColor="' . $footerColor . '";
$mainBack="' . $mainBack . '";
$mainA="' . $mainA . '";
$focusColor="' . $focusColor . '";
$focusBack="' . $focusBack . '";
$messPage="' . $messPage . '";
$timeSdvig="' . $timeSdvig . '";
$titlebook="' . $titlebook . '";
$iconbook="' . $iconbook . '";
$logoGB="' . $logoGB . '";
$headerGB="' . $headerGB . '";
?>');
fclose($file);
print 'Пароль на гостевую удален!';
}
if ($passGB != '') {
$dop = ' [<a href="./?id=' . $id . '&mod=setup&cat=access&gbpas=del">x</a>]';
}
print '
<form action="./?id=' . $id . '&mod=setup&cat=access" method="post">
<p>Новый пароль админа:</p>
<p><input name="newadminpass"/></p>
<p>Новый пароль доступа к гостевой' . $dop . ':</p>
<p><input name="newgbpass"/></p>
<p>Ник админа:</p>
<p><input name="newadminnick" value="' . $nickAdmin . '"/></p>
<p>E-mail админа:</p>
<p><input name="newadminmail" value="' . $emailAdmin . '"/></p>
<p><input type="submit" name="sub" value="Сохранить"/></p>
</form>
';
print '<div><a href="./?id=' . $id . '&mod=setup">[К настройкам]</a></div>';
}
print '<div><a href="./?id=' . $id . '">[В гостевую]</a></div>';
} else {
print 'А вам сюда нельзя!!! =)';
}
}
if ($mod == '') {
// ////////////////// страница сообщений
if (md5($pass) == $passwordAdmin) {
$adminauth = 'ok';
} else {
$adminauth = 'err';
}
print '<div><a href="./?id=' . $id . '&mod=add">[Написать]</a></div>';
$file = file('data/' . $id . '.dat');
$count = count($file);
$start = $count-1 - $messPage * $page;
for($i = 0;$i < $messPage;$i++) {
$num = $start - $i;
$dat = explode('{|||}', $file[$num]);
if ($adminauth == 'ok') {
$adminblock = '<p><a href="./?id=' . $id . '&mod=edit&mes=' . $num . '">[ред]</a> <a href="./?id=' . $id . '&mod=del&mes=' . $num . '">[уд]</a> </p>';
$ex=explode(', ',$dat[5]);
if($ex[1]!=''){ $sex='<a href="http://wen.ru/whois/?ip='.trim($ex[0]).'">'.trim($ex[0]).'</a>, <a href="http://wen.ru/whois/?ip='.trim($ex[1]).'">'.trim($ex[1]).'</a>';} else {$sex='<a href="http://wen.ru/whois/?ip='.trim($ex[0]).'">'.trim($ex[0]).'</a>';}
$brow = $dat[4] . ' - ' . $sex;
} else {
$brow = $dat[3];
}
if (trim($dat[7]) != '') {
$urllink = '<p><a href="' . trim($dat[7]) . '">[url]</a></p>';
}
if (trim($dat[0]) != '') {
print '<div>' . $num . '. ' . $dat[0] . ' [' . $dat[1] . ']</div>' . $urllink . '' . $adminblock . '
' . $dat[2] . '
';
if (trim($dat[8]) != '') {
print '<p>Ответ: ' . $dat[8].'</p>';
}
print '<p>[' . $brow . ']</p>';
}
}
if ($start < $count-1) {
$b = $page-1;
print '<div><a href="./?id=' . $id . '&page=' . $b . '">назад</a></div>';
}
if ($start - $messPage > 0) {
$n = $page + 1;
print '<div><a href="./?id=' . $id . '&page=' . $n . '">вперед</a></div>';
}
}
if (!isset($indexPage)) {
$indexPage = 'http://provo.spb.ru';
}
print '
<div><a href="' . $indexPage . '">[Главная]</a></div>
';
if ($adminauth == 'ok') {
print '
<div><a href="./?id=' . $id . '&mod=setup">[Настройки]</a></div>
<div><a href="./?id=' . $id . '&mod=exit">[Выход]</a></div>
';
}
print '
</div>
</body>
</html>
';
} else {
include 'users/' . $id . '.php';
if ($titlebook != '') {
$title = $titlebook;
} else {
$title = $_SERVER['SERVER_NAME'];
}
if ($iconbook == '') {
$iconbook = './icons/001.ico';
}
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xml:lang="ru" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>
' . $title . '
</title>
<link rel="icon" href="' . $iconbook . '" type="image/ico" />
<style type="text/css">
* {padding: 0; margin: 0;}
body{font-size: 12px; font-family: arial; line-height: 16px; background: '.$bodyBack.'; color: '.$bodyColor.';}
a, a:link, a:visited, a img {text-decoration: none; border: none; color: '.$aColor.';}
#header{background: '.$headerBack.'; text-align: center;}
/*#nav-main ul, #nav-main ul li {list-style: none inside;}*/
#nav-main div, #nav-main div a {display: block; height: 20px; line-height: 20px; background: '.$mainBack.'; margin: 2px 0; }
/*#nav-main div a img{line-height: 16px;}*/
#nav-main div a{padding: 0 5px; color:'.$mainA.';}
#nav-main div a:hover, #nav-main div a:active, #nav-main div a:focus{color: '.$focusColor.'; background: '.$focusBack.'; outline: none;}
</style>
</head>
<body>';
print ' <div id="header">';
if ($logoGB != '') {
print '<img src="' . $logoGB . '" alt="LOGO"/>';
}
if ($headerGB != '' && $logoGB != '') {
print '<hr/>';
}
if ($headerGB != '') {
print $headerGB;
}
print '
</div>
<div id="nav-main">';
print '
Доступ к гостевой ограничен администратором!!!
<p>
Введите пароль:</p>
<form action="./?id=' . $id . '" method="post">
<p><input name="passwordgbN"/></p>
<input type="submit" name="sub" value="Войти"/>
</form>
<div><a href="'.$indexPage.'">[Главная]</a></div>
';
print '
</div>
';
print '
</body>
</html>
';
}
} else {
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xml:lang="ru" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>
Сервис гостевых книг
</title>
<link rel="icon" href="./icons/001.ico" type="image/ico" />
<style type="text/css">
* {padding: 0; margin: 0;}
body{font-size: 12px; font-family: arial; line-height: 16px; background: #000000; color: #ff0000;}
a, a:link, a:visited, a img {text-decoration: none; border: none; color: #ff0000;}
#header{background: #b00000; text-align: center;}
/*#nav-main ul, #nav-main ul li {list-style: none inside;}*/
#nav-main div, #nav-main div a {display: block; height: 20px; line-height: 20px; background: #500000; margin: 2px 0; }
/*#nav-main div a img{line-height: 16px;}*/
#nav-main div a{padding: 0 5px; color: #ff0000;}
#nav-main div a:hover, #nav-main div a:active, #nav-main div a:focus{color: #ff9999; background: #900000; outline: none;}
</style>
</head>
<body>';
print ' <div id="header">
<img src="logo.png" alt="' . $_SERVER['SERVER_NAME'] . '"/>
</div>
<div id="nav-main">';
print '
Гостевая не найдена!!!
<div><a href="./">[Сервис гостевых]</a></div>
<div><a href="../">[Главная]</a></div>
';
print '
</div>
';
print '
</body>
</html>
';
}
}
?>