|
<?php
/*
# Somon Ashuraliev
# WapElita.Ru
*/
$title = 'Личные настройки';
require_once ('../system/function.php');
require_once ('../system/header.php');
# закрываем от гостей
if(!$user['id']) exit(header('Location: '.$HOME));
echo '<div class="title"><a href="'.$HOME.'/kab.php">Личный кабинет</a> | Личные настройки</div>';
if(isset($_REQUEST['ok'])) {
$style = strong($_POST['style']);
$style2 = strong($_POST['style2']);
$max = strong($_POST['max']);
$nt = strong($_POST['new_tem']);
$nf = strong($_POST['new_files']);
$ff = strong($_POST['form_file']);
$bp = strong($_POST['bb_panel']);
$zakr = strong($_POST['zakr']);
$ajax = strong($_POST['ajax']);
if (isset($_SERVER["HTTP_USER_AGENT"]) and
preg_match('#android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i#i', $_SERVER["HTTP_USER_AGENT"]))
{
mysql_query("UPDATE `users` SET `style` = '".$style."' WHERE `id` = '".$user['id']."'");
}
else if (isset($_SERVER["HTTP_USER_AGENT"]) and preg_match(
'#linux|bsd|x11|unix|macos|macintosh|#i', $_SERVER["HTTP_USER_AGENT"]))
{
mysql_query("UPDATE `users` SET `style2` = '".$style2."' WHERE `id` = '".$user['id']."'");
}
mysql_query("UPDATE `users` SET `zakr` = '".$zakr."', `max` = '".$max."', `ajax` = '".$ajax."', `new_tem` = '".$nt."', `new_files` = '".$nf."', `form_file` = '".$ff."', `bb_panel` = '".$bp."' WHERE `id` = '".$user['id']."'");
echo '<div class="podmenu"><center><b>Настройки успешно изменены!</b></center></div>';
}
echo '<div class="podmenu"><form name="form" action="?act=set&ok=1" method="post">';
if (isset($_SERVER["HTTP_USER_AGENT"]) and
preg_match('#android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i#i', $_SERVER["HTTP_USER_AGENT"]))
{
if (isset($_POST['style'])) {
if (trim(htmlspecialchars(mysql_real_escape_string($_POST['style'] ))) == 'WEB') setcookie('version', 'web', time()+60*60*24*14);
elseif (trim(htmlspecialchars(mysql_real_escape_string($_POST['style'] )))== 'WAP') setcookie('version', '');
}
echo '';
echo '
Выбрать стиль WAP:
<select name="style">';
$styles = glob('../design/theme/*', GLOB_ONLYDIR);
foreach ($styles as $style) {
$selected = ($u['style'] == basename($style)) ? ' selected="selected"' : '';
echo '<option value="'.basename($style).'"'.$selected.'>'.basename($style).'</option>';
}
echo '</select>';
}
else if (isset($_SERVER["HTTP_USER_AGENT"]) and preg_match(
'#linux|bsd|x11|unix|macos|macintosh|#i', $_SERVER["HTTP_USER_AGENT"]))
{
echo '</br />';
if (isset($_POST['style'])) {
if (trim(htmlspecialchars(mysql_real_escape_string($_POST['style2'] ))) == 'WEB') setcookie('version', 'web', time()+60*60*24*14);
elseif (trim(htmlspecialchars(mysql_real_escape_string($_POST['style2'] )))== 'WAP') setcookie('version', 'wap');
}
echo '';
echo '
Выбрать стиль WEB:
<select name="style2">';
$styles = glob('../design/theme/*', GLOB_ONLYDIR);
foreach ($styles as $style2) {
$selected = ($u['style2'] == basename($style2)) ? ' selected="selected"' : '';
echo '<option value="'.basename($style2).'"'.$selected.'>'.basename($style2).'</option>';
}
echo '</select>';
}
echo '
Пунктов на страницу:
<select name="max">';
$dat = array('5' => '5', '10' => '10', '15' => '15', '20' => '20');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['max'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Закрыть свои данные?</br> <select name="zakr">';
$dat = array('Нет' => '0', 'Да' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['zakr'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Ajax диалоги?</br> <select name="ajax">';
$dat = array('Нет' => '0', 'Да' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['ajax'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Темы на главной:
<select name="new_tem">';
$dat = array('Показывать' => '0', 'Скрывать' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['new_tem'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Файлы на главной:
<select name="new_files">';
$dat = array('Показывать' => '0', 'Скрывать' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['new_files'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Панель ВВ кодов:
<select name="bb_panel">';
$dat = array('Скрывать' => '0', 'Показывать' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['bb_panel'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo 'Выгрузка файлов:
<select name="form_file">';
$dat = array('Скрывать' => '0', 'Показывать поле' => '1');
foreach ($dat as $key => $value) {
echo ' <option value="'.$value.'"'.($value == $user['form_file'] ? ' selected="selected"' : '') .'>'.$key.'</option>';
}
echo '</select>
';
echo '<input type="submit" name="ok" value="Изменить" />
</form></div>';
echo '<div class="links">» <a href="'.$HOME.'/kab.php">Назад в кабинет</a></div>';
//-----Подключаем низ-----//
require_once ('../system/footer.php');
?>