<?php
define('MKTOP', 1);
require_once('../system/connect.php');
require_once('../system/core.php');
require_once('../system/function.php');
level(3);
$title = 'Sayt Ayarlari';
require_once('../head.php');
$nastroiki = '<form action="settings.php" method="post" name="form">
<div class="text">Saytin adi:<br/>
<input type="text" name="top_name" maxlength="30" class="do_button" value="'.$set['top_name'].'"/></div>
<div class="text">Adres (link http://):<br/>
<input type="text" name="home" maxlength="30" class="do_button" value="'.$set['home'].'"/></div>
<div class="text">İstifadəci saytlarin maksimal sayı:<br/>
<input type="number" name="max_platforms" maxlength="2" class="do_button" value="'.$set['max_platforms'].'"/></div>
<div class="text">İstifadəci saytlarin sehife sayi:<br/>
<input type="number" name="page_platforms" maxlength="2" class="do_button" value="'.$set['page_platforms'].'"/></div>
<div class="text">Kategoriyada sehife sayi:<br/>
<input type="number" name="page_sait" maxlength="2" class="do_button" value="'.$set['page_sait'].'"/></div>
<div class="text">Top-100 sehife sayi:<br/>
<input type="number" name="page_top" maxlength="2" class="do_button" value="'.$set['page_top'].'"/></div>
<div class="text">Statistika uzre sehife sayi:<br/>
<input type="number" name="pages" maxlength="2" class="do_button" value="'.$set['pages'].'"/></div>
<div class="text">Qeyd olanlara Bal hediyye:<br/>
<input type="number" name="prizkr" class="do_button" value="'.$set['prizkr'].'"/></div>
<div class="text">Aktiv Saytlar:<br/>
<input type="number" name="page_moderacia" maxlength="2" class="do_button" value="'.$set['page_moderacia'].'"/></div>
<div class="text">E-mail:<br/>
<input type="email" name="mail" maxlength="50" class="do_button" value="'.$set['mail'].'"/></div>
<div class="text">E-Mail (Admin):<br/>
<input type="email" name="adm_mail" maxlength="50" class="do_button" value="'.$set['adm_email'].'"/></div>
<div class="text">Qeydiyyat (aktiv/deaktiv):<br/><select name="power_reg">';
if ($set['power_reg'] == 0){
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
$nastroiki .= '<option value="1">Aktiv</option><br/>';
}
else{
$nastroiki .= '<option value="1">Aktiv</option><br/>';
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
}
$nastroiki .= '</select></div><div class="text">Tesdiqli Qeydiyyat:<br/><select name="power_moder">';
if ($set['moderacia'] == 0){
$nastroiki .= '<option value="0">Aktiv</option><br/>';
$nastroiki .= '<option value="1">Deaktiv</option><br/>';
}
else{
$nastroiki .= '<option value="1">Deaktiv</option><br/>';
$nastroiki .= '<option value="0">Aktiv</option><br/>';
}
$nastroiki .= '</select></div><div class="text">Mini chat (aktiv/deaktiv):<br/><select name="mini_chat">';
if ($set['mini_chat'] == 0){
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
$nastroiki .= '<option value="1">Aktiv</option><br/>';
}
else{
$nastroiki .= '<option value="1">Aktiv</option><br/>';
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
}
$nastroiki .= '</select></div><div class="text">Qeydiyyatsiz Sayt Elave Et (aktiv/deaktiv):<br/><select name="reg_free">';
if ($set['reg_free'] == 0){
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
$nastroiki .= '<option value="1">Aktiv</option><br/>';
}
else{
$nastroiki .= '<option value="1">Aktiv</option><br/>';
$nastroiki .= '<option value="0">Deaktiv</option><br/>';
}
$nastroiki .= '</select></div><div class="text">Reklam elave et (tesdiq/tesdiqsiz):<br/><select name="reklam">';
if ($set['reklam'] == 0){
$nastroiki .= '<option value="0">Tesdiq</option><br/>';
$nastroiki .= '<option value="1">Tesdiqsiz</option><br/>';
}
else{
$nastroiki .= '<option value="1">Tesdiqsiz</option><br/>';
$nastroiki .= '<option value="0">Tesdiq</option><br/>';
}
$nastroiki .= '</select></div><div class="text">Ferqli sayt (tesdiq/tesdiqsiz):<br/><select name="random">';
if ($set['random'] == 0){
$nastroiki .= '<option value="0">Tesdiq</option><br/>';
$nastroiki .= '<option value="1">Tesdiqsiz</option><br/>';
}
else{
$nastroiki .= '<option value="1">Tesdiqsiz</option><br/>';
$nastroiki .= '<option value="0">Tesdiq</option><br/>';
}
$nastroiki .= '</select></div><div class="text"><input name="ok" type="submit" value="Yadda Saxla" /></div></form>';
if(!isset($_POST['ok'])) echo $nastroiki;
else{
$top_name = filter($_POST['top_name']);
$home = filter($_POST['home']);
$home = trim(str_replace("http://","",$home));
$max_platforms = abs(intval($_POST['max_platforms']));
$page_platforms = abs(intval($_POST['page_platforms']));
$page_sait = abs(intval($_POST['page_sait']));
$page_top = abs(intval($_POST['page_top']));
$pages = abs(intval($_POST['pages']));
$prizkr = abs(intval($_POST['prizkr']));
$page_moderacia = abs(intval($_POST['page_moderacia']));
$power_reg = abs(intval($_POST['power_reg']));
$mini_chat = abs(intval($_POST['mini_chat']));
$reg_free = abs(intval($_POST['reg_free']));
$reklam = abs(intval($_POST['reklam']));
$random = abs(intval($_POST['random']));
$mail = filter($_POST['mail']);
$adm_mail = filter($_POST['adm_mail']);
$moderacia = abs(intval($_POST['power_moder']));
$error = '';
if(empty($home))
$error .= '<div class="error">Butun bolmeleri doldurun</div>';
else{
if (!empty($mail) and !preg_match('#^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+(\.([A-Za-z0-9])+)+$#', $mail))
$error .= '<div class="error">Sehf E-mail !</div>';
if (!empty($adm_mail) and !preg_match('#^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+(\.([A-Za-z0-9])+)+$#', $adm_mail))
$error .= '<div class="error">Sehf E-mail (Admin) !</div>';
}
if(!empty($error)){
echo $error;
echo $nastroiki;
}
else{
mysql_query("UPDATE `settings` SET `value` = '".$mail."' WHERE `name` = 'mail'");
mysql_query("UPDATE `settings` SET `value` = '".$top_name."' WHERE `name` = 'top_name'");
mysql_query("UPDATE `settings` SET `value` = '".$home."' WHERE `name` = 'home'");
mysql_query("UPDATE `settings` SET `value` = '".$max_platforms."' WHERE `name` = 'max_platforms'");
mysql_query("UPDATE `settings` SET `value` = '".$page_platforms."' WHERE `name` = 'page_platforms'");
mysql_query("UPDATE `settings` SET `value` = '".$page_sait."' WHERE `name` = 'page_sait'");
mysql_query("UPDATE `settings` SET `value` = '".$page_top."' WHERE `name` = 'page_top'");
mysql_query("UPDATE `settings` SET `value` = '".$pages."' WHERE `name` = 'pages'");
mysql_query("UPDATE `settings` SET `value` = '".$prizkr."' WHERE `name` = 'prizkr'");
mysql_query("UPDATE `settings` SET `value` = '".$page_moderacia."' WHERE `name` = 'page_moderacia'");
mysql_query("UPDATE `settings` SET `value` = '".$power_reg."' WHERE `name` = 'power_reg'");
mysql_query("UPDATE `settings` SET `value` = '".$mini_chat."' WHERE `name` = 'mini_chat'");
mysql_query("UPDATE `settings` SET `value` = '".$reg_free."' WHERE `name` = 'reg_free'");
mysql_query("UPDATE `settings` SET `value` = '".$reklam."' WHERE `name` = 'reklam'");
mysql_query("UPDATE `settings` SET `value` = '".$random."' WHERE `name` = 'random'");
mysql_query("UPDATE `settings` SET `value` = '".$moderacia."' WHERE `name` = 'moderacia'");
mysql_query("UPDATE `settings` SET `value` = '".$adm_mail."' WHERE `name` = 'adm_email'");
echo '<div class="text">Ayarlar uğurla deyişdirildi!</div>';
}
}
if($user_data['level'] == 3) echo '<a class="link" href="index.php">Admin Panel</a>';
require_once('../foot.php');
?>