<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);
include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 


##if @BUILDER.bCreateLoginPage##
if(!@$_SESSION["UserID"])
{ 
	return;
}
if(!$_SESSION["IsAdmin"])
{
	return;
}
##endif##






if(@$_GET["a"]=="add")
{
	$sql ="insert into ##@BUILDER.strUGGroups ts## (Label) values ('".db_addslashes(@$_GET["name"])."')";
	db_exec($sql,$conn);
	$sql = "select max(GroupID) from ##@BUILDER.strUGGroups ts##";
	$rs=db_query($sql,$conn);
	$data=db_fetch_numarray($rs);
	echo "ok";
	echo $data[0];
}

if(@$_GET["a"]=="del")
{
	$sql ="delete from ##@BUILDER.strUGGroups ts## where GroupID=".(@$_GET["id"]+0);
	db_exec($sql,$conn);
	echo "ok";
}


if(@$_GET["a"]=="rename")
{
	$sql ="update ##@BUILDER.strUGGroups ts## set Label='".db_addslashes(@$_GET["name"])."' where GroupID=".(@$_GET["id"]+0);
	db_exec($sql,$conn);
	echo "ok";
}
