<?php
if(!isset($_POST['action']))
{
$file = file("system/banner.dat");
$ssylka = trim($file[0]);
$img = trim($file[1]);
$komnaty = trim($file[2]);
$pochta = trim($file[3]);
$kabinet = trim($file[4]);
$igra = trim($file[5]);
$pomosch = trim($file[6]);

echo "<form method=\"post\" action=\"superadmin.php?".SID."&amp;pass=$pass&amp;ver=html&amp;mod=banner\">\n";
echo "Ссылка:<br/>\n";
echo "<input type=\"text\" name=\"ssylka\" maxlength=\"250\" value=\"http://$ssylka\"/><br/>\n";
echo "Картинка:<br/>\n";
echo "<input type=\"text\" name=\"img\" maxlength=\"250\" value=\"http://$img\"/><br/>\n";
echo "Показывать баннер:<br/>\n";
echo "В комнатах:\n";
echo "<input type=\"checkbox\" name=\"komnaty\" value=\"da\" checked=\"checked\"/><br/>\n";
echo "В почте:\n";
echo "<input type=\"checkbox\" name=\"pochta\" value=\"da\" checked=\"checked\"/><br/>\n";
echo "В личном кабинете:\n";
echo "<input type=\"checkbox\" name=\"kabinet\" value=\"da\" checked=\"checked\"/><br/>\n";
echo "В играх:\n";
echo "<input type=\"checkbox\" name=\"igra\" value=\"da\" checked=\"checked\"/><br/>\n";
echo "В помощи:\n";
echo "<input type=\"checkbox\" name=\"pomosch\" value=\"da\" checked=\"checked\"/><br/>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\"/>\n";
echo "<input type=\"submit\" value=\"Сохранить\"/></form></div>\n";
}
else
{
$ssylka = trim(htmlspecialchars($_POST['ssylka']));
$ssylka = str_replace('$', '$$', $ssylka);
$ssylka = str_replace('http://', '', $ssylka);
$img = trim(htmlspecialchars($_POST['img']));
$img = str_replace('$', '$$', $img);
$img = str_replace('http://', '', $img);
$komnaty = trim(htmlspecialchars($_POST['komnaty']));
$komnaty = str_replace('$', '$$', $komnaty);
$pochta = trim(htmlspecialchars($_POST['pochta']));
$pochta = str_replace('$', '$$', $pochta);
$kabinet = trim(htmlspecialchars($_POST['kabinet']));
$kabinet = str_replace('$', '$$', $kabinet);
$igra = trim(htmlspecialchars($_POST['igra']));
$igra = str_replace('$', '$$', $igra);
$pomosch = trim(htmlspecialchars($_POST['pomosch']));
$pomosch = str_replace('$', '$$', $pomosch);
$ssylka = str_replace("\r\n", "", $ssylka);
$ssylka = str_replace("\n", "", $ssylka);
$img = str_replace("\r\n", "", $img);
$img = str_replace("\n", "", $img);
$komnaty = str_replace("\r\n", "", $komnaty);
$komnaty = str_replace("\n", "", $komnaty);
$pochta = str_replace("\r\n", "", $pochta);
$pochta = str_replace("\n", "", $pochta);
$kabinet = str_replace("\r\n", "", $kabinet);
$kabinet = str_replace("\n", "", $kabinet);
$igra = str_replace("\r\n", "", $igra);
$igra = str_replace("\n", "", $igra);
$pomosch = str_replace("\r\n", "", $pomosch);
$pomosch = str_replace("\n", "", $pomosch);

$file = fopen("system/banner.dat", "w");
$data = "$ssylka\n";
$data .= "$img\n";
$data .= "$komnaty\n";
$data .= "$pochta\n";
$data .= "$kabinet\n";
$data .= "$igra\n";
$data .= "$pomosch";

fwrite($file, $data);
fclose($file);

echo "Данные успешно сохранены!<br/>\n";
}
?>