<?php

require( "../inc/conf.inc.php" );
require( "../inc/check.php" );
$login = autorize();
$login = $row['login'];
$level = $row['level'];
echo "<title>{$cname}</title>";
echo "<style type=\"text/css\">";
echo "body { margin: auto; max-width: 500px; font: 12px Arial; color: #808080; background-color: #000000; }";
echo "a:link,a:visited { text-decoration: none; color: b0c4db; }";
echo "div { background-color: #202020; border-style:solid; border-width: 1px; }";
echo "img { vertical-align: middle; }";
echo "</style>";
echo "</head>";
echo "<body>";
if ( $level < 6 )
{
echo "<div>Гандон Ипаш нахуй Эта дыра закрыта Котом waufon.ru</div>";
}
else
{
echo "<div>Настройка системы</div>";
switch ( $go )
{
case 'link':
$setting = @mysql_query ("Select * from setting where klu4=1");
$set = mysql_fetch_array ($setting);
echo "<form method=\"POST\" action=\"apanel.php?id={$id}&amp;pass={$pass}&amp;go=updlink$takep\" name=\"auth\">\n";
echo "<p align=\"left\">&#187; <b>Ссылка при входе в чЯт.</b>";
echo "<div><p align=\"left\">http://";
echo "<input name=\"link1\" maxlength=\"120\" value=\"".$set["link1"]."\" title=\"link1\"/><br/>\n";  
echo "<b>Название ссылки</b><br/>";
echo "<input name=\"link1_name\" maxlength=\"40\" value=\"".$set["link1_name"]."\" title=\"link1_name\"/></div>\n";  

echo "<p align=\"left\">&#187; <b>Ссылка в прихожей</b><br/>";
echo "<div><p align=\"left\">http://";
echo "<input name=\"link2\" maxlength=\"120\" value=\"".$set["link2"]."\" title=\"link2\"/><br/>\n";  
echo "<b>Название ссылки</b><br/>";
echo $fsize2;
echo "<input name=\"link2_name\" maxlength=\"40\" value=\"".$set["link2_name"]."\" title=\"link2_name\"/></div>\n";  

echo "<p align=\"left\">&#187; <b>Адрес картинки при входе в чат</b>";
echo "<div><p align=\"left\">";
echo "<input name=\"link3\" maxlength=\"120\" value=\"".$set["link3"]."\" title=\"link3\"/></div>\n";  
echo "<p align=\"left\"><b>Приветствие при входе в чат</b><br/>";

echo "<div><p align=\"left\"><input name=\"link3_name\" maxlength=\"40\" value=\"".$set["link3_name"]."\" title=\"link3_name\"/></div>\n"; 
echo "<p align=\"left\"><input type=\"submit\" value=\"Изменить\" name=\"enter\"><br/>\n";

break;

case 'updlink':
if(!eregi("^((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)\$", $link1))$link1="";
if(!eregi("^((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)\$", $link2))$link2="";
if(!eregi("^((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)\$", $link3))$link3="";
$link1_name = check($link1_name); 
$link2_name = check($link2_name);
$link3_name = check($link3_name);
$link1_name = mysql_escape_string($link1_name);
$link2_name = mysql_escape_string($link2_name);
$link3_name = mysql_escape_string($link3_name);
if (!isset($error)) {
$result = mysql_query ("Select * setting where klu4 = '1'");
if (mysql_affected_rows() == 0) {
$error = "database error...";
} else {
mysql_query ("Update setting set link1='".$link1."', link2='".$link2."', link3='".$link3."', link1_name='".$link1_name."', link2_name='".$link2_name."', link3_name='".$link3_name."' where klu4 = '1'");
$msg = "Настройки Линков сохранены";
}
} else {
$error = " ".mysql_error()." ";
}
if (isset($error)) {
echo $fsize1;
echo "$error\n";
echo $fsize2;
} 
echo $fsize1;
echo "<b>$msg</b><br/>\n";
echo $fsize2;
break;



////////ГЛАВНАЯ///////
default :
echo "<br/><div><p align=\"left\">&#187; <a href=\"apanel.php?id={$id}&amp;pass={$pass}&amp;ref={$ref}&amp;go=link$takep\">Рекламные Ссылки</a><br/>";
echo "&#187; </div>";
}
}
print "<a href=\"index.php?id={$id}&amp;pass={$pass}\">cPanel</a><br/>";
echo "<a href=\"../enter.php?id={$id}&amp;pass={$pass}\">Прихожая</a><br/><p>{$ip}</p>";
$end = gettime( );
echo "<p align=\"center\">";
echo "[".round( $end - $mystart, 5 )."]";
echo "</p></body></html>";
mysql_close( $link );
?>