Checkbox помощь

167
.
$lng_set = core::load_lng('settings'); 
$textl = $lng['settings']; 
require('../incfiles/head.php'); 

/* 
----------------------------------------------------------------- 
Проверяем права доступа 
----------------------------------------------------------------- 
*/ 
if ($user['id'] != $user_id) { 
echo functions::display_error($lng['access_forbidden']); 
require('../incfiles/end.php'); 
exit; 
} 

$menu = array( 
(!$mod ? '<b>' . $lng['common_settings'] . '</b>' : '<a href="profile.php?act=settings">' . $lng['common_settings'] . '</a>'), 
($mod == 'forum' ? '<b>' . $lng['forum'] . '</b>' : '<a href="profile.php?act=settings&amp;mod=forum">' . $lng['forum'] . '</a>'), 
($mod == 'mail' ? '<b>' . $lng['mail'] . '</b>' : '<a href="profile.php?act=settings&amp;mod=mail">' . $lng['mail'] . '</a>'), 
($mod == 'bildirim' ? '<b>' . $lng['bildirim'] . '</b>' : '<a href="profile.php?act=settings&amp;mod=bildirim">' . $lng['bildirim'] . '</a>'), 
); 

/* 
----------------------------------------------------------------- 
Пользовательские настройки 
----------------------------------------------------------------- 
*/ 
switch ($mod) { 
case 'bildirim': 

-------> здесь ??????

break; 

case 'mail': 
echo '<div class="phdr"><b>' . $lng['settings'] . '</b> | ' . $lng['mail'] . '</div>' . 
'<div class="topmenu">' . functions::display_menu($menu) . '</div>'; 

$set_mail_user = unserialize($datauser['set_mail']); 
if (isset($_POST['submit'])) { 
$set_mail_user['access'] = isset($_POST['access']) && $_POST['access'] >= 0 && $_POST['access'] <= 2 ? abs(intval($_POST['access'])) : 0; 
mysql_query("UPDATE `users` SET `set_mail` = '" . mysql_real_escape_string(serialize($set_mail_user) ) . "' WHERE `id` = '$user_id'"); 
} 

echo '<form method="post" action="profile.php?act=settings&amp;mod=mail">' . 
'<div class="menu">' . 
'<strong>' . $lng_profile['write_messages'] . '</strong><br />' . 
'<input type="radio" value="0" name="access" ' . (!$set_mail_user['access'] ? 'checked="checked"' : '') . '/> ' . $lng_profile['write_all'] . '<br />' . 
'<input type="radio" value="1" name="access" ' . ($set_mail_user['access'] == 1 ? 'checked="checked"' : '') . '/> ' . $lng_profile['write_contacts'] . '<br />' . 
'<input type="radio" value="2" name="access" ' . ($set_mail_user['access'] == 2 ? 'checked="checked"' : '') . '/> ' . $lng_profile['write_friends'] . 
'<br/><p><input type="submit" name="submit" value="' . $lng['save'] . '"/></p></div></form>' . 
'<div class="phdr"> </div>'; 
break; 

case 'forum': 
/* 
----------------------------------------------------------------- 
Настройки Форума 
----------------------------------------------------------------- 
*/ 
echo '<div class="phdr"><b>' . $lng['settings'] . '</b> | ' . $lng['forum'] . '</div>' . 
'<div class="topmenu">' . functions::display_menu($menu) . '</div>'; 
$set_forum = array(); 
$set_forum = unserialize($datauser['set_forum']); 
if (isset($_POST['submit'])) { 
$set_forum['farea'] = isset($_POST['farea']); 
$set_forum['upfp'] = isset($_POST['upfp']); 
$set_forum['preview'] = isset($_POST['preview']); 
$set_forum['postclip'] = isset($_POST['postclip']) ? intval($_POST['postclip']) : 1; 
if ($set_forum['postclip'] < 0 || $set_forum['postclip'] > 2) { 
$set_forum['postclip'] = 1; 
} 
mysql_query("UPDATE `users` SET `set_forum` = '" . mysql_real_escape_string(serialize($set_forum)) . "' WHERE `id` = '$user_id'"); 
echo '<div class="gmenu">' . $lng['settings_saved'] . '</div>'; 
} 
if (isset($_GET['reset']) || empty($set_forum)) { 
$set_forum = array(); 
$set_forum['farea'] = 0; 
$set_forum['upfp'] = 0; 
$set_forum['preview'] = 1; 
$set_forum['postclip'] = 1; 
mysql_query("UPDATE `users` SET `set_forum` = '" . mysql_real_escape_string(serialize($set_forum)) . "' WHERE `id` = '$user_id'"); 
echo '<div class="rmenu">' . $lng['settings_default'] . '</div>'; 
} 
echo '<form action="profile.php?act=settings&amp;mod=forum" method="post">' . 
'<div class="menu"><p><h3>' . $lng_set['main_settings'] . '</h3>' . 
'<input name="upfp" type="checkbox" value="1" ' . ($set_forum['upfp'] ? 'checked="checked"' : '') . ' /> ' . $lng_set['sorting_return'] . '<br/>' . 
'<input name="farea" type="checkbox" value="1" ' . ($set_forum['farea'] ? 'checked="checked"' : '') . ' /> ' . $lng_set['field_on'] . '<br/>' . 
'<input name="preview" type="checkbox" value="1" ' . ($set_forum['preview'] ? 'checked="checked"' : '') . ' /> ' . $lng['preview'] . '<br/>' . 
'</p><p><h3>' . $lng_set['clip_first_post'] . '</h3>' . 
'<input type="radio" value="2" name="postclip" ' . ($set_forum['postclip'] == 2 ? 'checked="checked"' : '') . '/> ' . $lng_set['always'] . '<br />' . 
'<input type="radio" value="1" name="postclip" ' . ($set_forum['postclip'] == 1 ? 'checked="checked"' : '') . '/> ' . $lng_set['in_not_read'] . '<br />' . 
'<input type="radio" value="0" name="postclip" ' . (!$set_forum['postclip'] ? 'checked="checked"' : '') . '/> ' . $lng_set['never'] . 
'</p><p><input type="submit" name="submit" value="' . $lng['save'] . '"/></p></div></form>' . 
'<div class="phdr"><a href="profile.php?act=settings&amp;mod=forum&amp;r eset">' . $lng['reset_settings'] . '</a></div>'; 
break; 

default: 
echo '<div class="phdr"><b>' . $lng['settings'] . '</b> | ' . $lng['common_settings'] . '</div>' . 
'<div class="topmenu">' . functions::display_menu($menu) . '</div>'; 
if (isset($_POST['submit'])) { 
/* 
----------------------------------------------------------------- 
Записываем новые настройки, заданные пользователем 
----------------------------------------------------------------- 
*/ 
$set_user['timeshift'] = isset($_POST['timeshift']) ? intval($_POST['timeshift']) : 0; 
$set_user['avatar'] = isset($_POST['avatar']); 
$set_user['smileys'] = isset($_POST['smileys']); 
$set_user['translit'] = isset($_POST['translit']); 
$set_user['digest'] = isset($_POST['digest']); 
$set_user['direct_url'] = isset($_POST['direct_url']); 
$set_user['field_h'] = isset($_POST['field_h']) ? abs(intval($_POST['field_h'])) : 3; 
$set_user['kmess'] = isset($_POST['kmess']) ? abs(intval($_POST['kmess'])) : 10; 
$set_user['quick_go'] = isset($_POST['quick_go']); 
if ($set_user['timeshift'] < -12) 
$set_user['timeshift'] = -12; 
elseif ($set_user['timeshift'] > 12) 
$set_user['timeshift'] = 12; 
if ($set_user['kmess'] < 5) 
$set_user['kmess'] = 5; 
elseif ($set_user['kmess'] > 99) 
$set_user['kmess'] = 99; 
if ($set_user['field_w'] < 10) 
$set_user['field_w'] = 10; 
elseif ($set_user['field_w'] > 80) 
$set_user['field_w'] = 80; 
if ($set_user['field_h'] < 1) 
$set_user['field_h'] = 1; 
elseif ($set_user['field_h'] > 9) 
$set_user['field_h'] = 9; 

// Устанавливаем скин 
foreach (glob('../theme/*/*.css') as $val) 
$theme_list[] = array_pop(explode('/', dirname($val))); 
$set_user['skin'] = isset($_POST['skin']) && in_array($_POST['skin'], $theme_list) ? functions::check($_POST['skin']) : $set['skindef']; 

// Устанавливаем язык 
$lng_select = isset($_POST['iso']) ? trim($_POST['iso']) : false; 
if ($lng_select && array_key_exists($lng_select, core::$lng_list)) { 
$set_user['lng'] = $lng_select; 
unset($_SESSION['lng']); 
} 

// Записываем настройки 
mysql_query("UPDATE `users` SET `set_user` = '" . mysql_real_escape_string(serialize($set_user)) . "' WHERE `id` = '$user_id'"); 
$_SESSION['set_ok'] = 1; 
header('Location: profile.php?act=settings'); 
exit; 
} elseif (isset($_GET['reset']) || empty($set_user)) { 
/* 
----------------------------------------------------------------- 
Задаем настройки по-умолчанию 
----------------------------------------------------------------- 
*/ 
mysql_query("UPDATE `users` SET `set_user` = '' WHERE `id` = '$user_id'"); 
$_SESSION['reset_ok'] = 1; 
header('Location: profile.php?act=settings'); 
exit; 
} 

/* 
----------------------------------------------------------------- 
Форма ввода пользовательских настроек 
----------------------------------------------------------------- 
*/ 
if (isset($_SESSION['set_ok'])) { 
echo '<div class="rmenu">' . $lng['settings_saved'] . '</div>'; 
unset($_SESSION['set_ok']); 
} 
if (isset($_SESSION['reset_ok'])) { 
echo '<div class="rmenu">' . $lng['settings_default'] . '</div>'; 
unset($_SESSION['reset_ok']); 
} 
echo '<form action="profile.php?act=settings" method="post" >' . 
'<div class="menu"><p><h3>' . $lng['settings_clock'] . '</h3>' . 
'<input type="text" name="timeshift" size="2" maxlength="3" value="' . core::$user_set['timeshift'] . '"/> ' . $lng['settings_clock_shift'] . ' (+-12)<br />' . 
'<span style="font-weight:bold; background-color:#CCC">' . date("H:i", time() + (core::$system_set['timeshift'] + core::$user_set['timeshift']) * 3600) . '</span> ' . $lng['system_time'] . 
'</p><p><h3>' . $lng['system_functions'] . '</h3>' . 
'<input name="direct_url" type="checkbox" value="1" ' . (core::$user_set['direct_url'] ? 'checked="checked"' : '') . ' /> ' . $lng['direct_url'] . '<br />' . 
'<input name="avatar" type="checkbox" value="1" ' . (core::$user_set['avatar'] ? 'checked="checked"' : '') . ' /> ' . $lng['avatars'] . '<br/>' . 
'<input name="smileys" type="checkbox" value="1" ' . (core::$user_set['smileys'] ? 'checked="checked"' : '') . ' /> ' . $lng['smileys'] . '<br/>' . 
'</p><p><h3>' . $lng['text_input'] . '</h3>' . 
'<input type="text" name="field_h" size="2" maxlength="1" value="' . core::$user_set['field_h'] . '"/> ' . $lng['field_height'] . ' (1-9)<br />'; 
if (core::$lng_iso == 'ru' || core::$lng_iso == 'uk') echo '<input name="translit" type="checkbox" value="1" ' . (core::$user_set['translit'] ? 'checked="checked"' : '') . ' /> ' . $lng['translit']; 
echo '</p><p><h3>' . $lng['apperance'] . '</h3>' . 
'<input type="text" name="kmess" size="2" maxlength="2" value="' . core::$user_set['kmess'] . '"/> ' . $lng['lines_on_page'] . ' (5-99)' . 
'</p>'; 

// Выбор темы оформления 
echo '<p><h3>' . $lng['design_template'] . '</h3><select name="skin">'; 
foreach (glob('../theme/*/*.css') as $val) { 
$dir = explode('/', dirname($val)); 
$theme = array_pop($dir); 
echo '<option' . (core::$user_set['skin'] == $theme ? ' selected="selected">' : '>') . $theme . '</option>'; 
} 
echo '</select></p>'; 

// Выбор языка 
if (count(core::$lng_list) > 1) { 
echo '<p><h3>' . $lng['language_select'] . '</h3>'; 
$user_lng = isset(core::$user_set['lng']) ? core::$user_set['lng'] : core::$lng_iso; 
foreach (core::$lng_list as $key => $val) { 
echo '<div><input type="radio" value="' . $key . '" name="iso" ' . ($key == $user_lng ? 'checked="checked"' : '') . '/> ' . 
(file_exists('../images/flags/' . $key . '.gif') ? '<img src="../images/flags/' . $key . '.gif" alt=""/> ' : '') . 
$val . 
($key == core::$system_set['lng'] ? ' <small class="red">[' . $lng['default'] . ']</small>' : '') . 
'</div>'; 
} 
echo '</p>'; 
} 

echo '<p><input type="submit" name="submit" value="' . $lng['save'] . '"/></p></div></form>' . 
'<div class="phdr"><a href="profile.php?act=settings&amp;reset">' . $lng['reset_settings'] . '</a></div>'; 
}


Users tablo
id	name	name_lat	password	rights	failed_login	imname	sex komm	postforum	postguest	postchat	yearofbirth	datereg lastdate	mail	icq	skype	jabber	www	about	live	mibile	status	ip ip_via_proxy	browser	preg	regadm	mailvis	dayb	monthb	sestime total_on_site	lastpost	rest_code	rest_time	movings	place set_user	set_forum	set_mail	karma_plus	karma_minus karma_time	karma_off	comm_count	comm_old	smileys	balans balans_day	balans_time	balls	prosm_ank	bot	notif_mail notif_sys_mail


Users column: notif_mail and notif_sys_mail value 0 and 1 checkbox checklist ?
Всего: 1