<?php
error_reporting(0);
close_browse();
if (!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) {exit();}
global $db, $CcTvAi_com_userid;
$callback=SafeRequest("callback", "get");
if ($CcTvAi_com_userid) {
	$cd_fgid=SafeRequest("fgid", "post");
	if(!IsNumID($CcTvAi_com_userid)) {exit();}
	if(!IsNumID($cd_fgid)) {exit();}
	$cd_fgName=unescape(SafeRequest("fg_name", "post"));
	if ($cd_fgName=='') {exit('10007');}
	if (mb_strlen($cd_fgName, 'UTF8')>7) {exit('10006');}
	$db->query("update " . tname('friendgroup') . " set cd_name='" . $cd_fgName . "' where cd_uid='" . $CcTvAi_com_userid . "' and cd_id='" . $cd_fgid . "'");
	echo $cd_fgName;
} else {
	exit('20001');
}
?>