<?php
/********************************************************/
/* NSN Groups                                           */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright  2000-2005 by NukeScripts Network         */
/********************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}

list($phpBB_old) = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `phpBB` FROM `".TABLE_NSNGR_GROUPS."` WHERE `gid`='$gid'"));
list($phpBB_new) = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `phpBB` FROM `".TABLE_NSNGR_GROUPS."` WHERE `gid`='$new_gid'"));
if (!is_ingroup($uid,$new_gid)) {
  $GLOBALS['db']->sql_query("UPDATE `".TABLE_NSNGR_USERS."` SET `gid`='$new_gid' WHERE `gid`='$gid' AND `uid`='$uid'");
  $GLOBALS['db']->sql_query("UPDATE `".$prefix."_bbuser_group` SET `group_id`='$phpBB_new' WHERE `group_id`='$phpBB_old' AND `user_id`='$uid'");
}
redirect_url("".$admin_file.".php?op=NSNGroupsUsersView&gid=$new_gid");