<?php

if (!empty($_POST['save']))
{
	$type = abs(intval($_POST['type']));
	$access_wall = abs(intval($_POST['access_wall']));
	$access_comm = abs(intval($_POST['access_comm']));
	$access_shop = abs(intval($_POST['access_shop']));
	$access_board = abs(intval($_POST['access_board']));
	$access_new_users = abs(intval($_POST['access_new_users']));

	if (empty($type) || $type != 1) $type = 0;
	if (empty($access_wall) || $access_wall < 0 || $access_wall > 2) $access_wall = 0;
	if (empty($access_comm) || $access_comm < 0 || $access_comm > 2) $access_comm = 0;
	if (empty($access_shop) || $access_shop < 0 || $access_shop > 2) $access_shop = 0;
	if (empty($access_board) || $access_board < 0 || $access_board > 2) $access_board = 0;
   	if (empty($access_new_users) || $access_new_users != 1) $access_new_users = 0;

	if ($err == false && mysql_query("UPDATE `groups` SET
	`type` = '".$type."',
	`access_wall` = '".$access_wall."',
	`access_comm` = '".$access_comm."',
	`access_shop` = '".$access_shop."',
	`access_board` = '".$access_board."',
	`access_new_users` = '".$access_new_users."'
	WHERE `id` = '".$id."'") == true)
	{
		$arr_group = mysql_fetch_array(mysql_query("SELECT * FROM `groups` WHERE `id` = '".$id."' LIMIT 1"));
		echo ok(lang('Изменения сохранены','Зміни збережені'));
	}
}

?>