<?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");
}

$xdate = time();
$datenew = $newyear."-".$newmonth."-".$newday." ".$newhour.":".$newmin.":00";
if ($datenew == "0000-00-00 00:00:00") { $ydate = "0"; } else { $ydate = strtotime($datenew); }
$j = count($add_uid);
for ($i=0; $i < $j; $i++) {
  if (!is_ingroup($add_uid[$i],$gid)) {
    list($phpBB) = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `phpBB` FROM `".TABLE_NSNGR_GROUPS."` WHERE `gid`='$gid'"));
    list($u_name) = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `username` FROM `".TABLE_USERS."` WHERE `user_id`='$add_uid[$i]'"));
    $GLOBALS['db']->sql_query("INSERT INTO `".TABLE_NSNGR_USERS."` (gid, uid, uname, sdate, edate) VALUES ('$gid', '$add_uid[$i]', '$u_name', '$xdate', '$ydate')");
    $GLOBALS['db']->sql_query("INSERT INTO `".$prefix."_bbuser_group` (group_id, user_id, user_pending) VALUES ('$phpBB', '$add_uid[$i]', '0')");
  }
}
redirect_url("".$admin_file.".php?op=NSNGroupsUsersAdd&gid=$gid&min=$min");