<?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_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_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_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('Изменения сохранены','Зміни збережені'));
	}
}

?>