<?PHP
/* JAG Online -------------------------- 06/03/2004 ------------------ v1.31 [6.5~7.1] */
/*                                                                                     */
/*      ////////// //\\ \\\\\\\\\\       Created by Dashe at http://nsd.jagamarog.com  */
/*             // //  \\ \\                                                            */
/*            // //    \\ \\             Email Address:           dashe@jagamarog.com  */
/*           // /////\\\\\ \\   \\\\\                                                  */
/*          // //        \\ \\      \\                                                 */
/*         // //          \\ \\\\\\\\\\                                                */
/* /////////  a g a m a r o g . c o m   N u k e   S c r i p t   D e v e l o p m e n t  */
/*                                                                                     */     
/* Created By Dashe -> http://nsd.jagamarog.com                                        */ 
/*                                                                                     */
/* ----------------------------------------------------------------------------------- */

/* DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING ------------------------------ */

/* Check For Hack Attack ------------------------------------------------------------- */
if (!eregi("admin.php", $_SERVER['PHP_SELF'])) 
	{
	die ("Access Denied"); 
	}

/* See If Is GOD Or Admin That Has Access -------------------------------------------- */
$Q90 = "SELECT radminsuper 
		FROM ".$prefix."_authors 
		WHERE aid = '$aid'";
$R90 =  $db -> sql_query($Q90) or die("Bad Q01:".mysql_error());
list($radminsuper) = sql_fetch_row($R90);

if ($radminsuper == 1)
	{
	/* Set The Appropriate Language File ---------------------------------------------- */
	if (file_exists ("language/JAG_Online/lang-$currentlang.php"))
		include_once("language/JAG_Online/lang-$currentlang.php");
	else 
		include_once("language/JAG_Online/lang-arabic.php");
		
	/* Define Functions For Admin ---------------------------------------------------- */
	function CheckStatus($Variable, $Option)
		{
		if ($Variable == $Option)  return "CHECKED";			
		}
		
	function CheckSelected($Variable, $Option)
		{
		if ($Variable == $Option)  return "SELECTED";			
		}	

	function CreateYesNo ($title_text, $yes, $no, $name, $value)
		{
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							$title_text</TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							$yes</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='$name' VALUE='1' ".CheckStatus($value, 1)."></TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							&nbsp;$no</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='$name' VALUE='0' ".CheckStatus($value, 0)."></TD>\n";
		echo "					</TR>\n";
		}	
			
	/* Start The Content For The Page ------------------------------------------- */
	echo "	<TABLE ALIGN='right' WIDTH='500' BORDER='1' CELLPADDING='0' CELLSPACING='0' BORDERCOLOR='$bgcolor2'>\n";
	echo "		<FORM NAME='switch' ACTION='admin.php' METHOD='POST'>\n";
	echo "		<TR>\n";
	echo "			<TD WIDTH='100%' ALIGN='right' VALIGN='TOP'>\n";
	echo "				<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='right'>\n";
	echo "					<TR>\n";
	echo "						<TD ALIGN='right' WIDTH='175'>\n";
	echo "							<A HREF='admin.php?op=JAG_Admin&for=JAG_Online'><B>"._MAIN_ICON."</A></TD>\n";
	echo "						<TD ALIGN='right' WIDTH='175'>\n";
	echo "							<A HREF='admin.php?op=JAG_Admin&for=JAG_Online&do=pref'><B>"._MAIN_PREF."</A></TD>\n";
	echo "					</TR>\n";
	echo "				</TABLE>\n";
	echo "			</TD>\n";
	echo "		</TR>\n";
	echo "		</FORM>\n";	

	function CurrentIcons()
		{
    	global $bgcolor2, $currentlang, $prefix, $db, $icon_user, $do;

		/* Get Config Settings For The Block ---------------------------------------- */
		$Q91 = "SELECT *
				FROM ".$prefix."_jag_online_config";
		$R91 =  $db -> sql_query($Q91) or die("Bad Q91:".mysql_error());
		$AdminCfg = sql_fetch_array($R91);		
				
		/* Main Preferences Section ------------------------------------------------- */
		echo "		<TR>\n";
		echo "			<TD WIDTH='100%' ALIGN='right' VALIGN='TOP'>\n";
		echo "				<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='right'>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='2' CLASS='title'><B>"._ICON_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='2'>"._ICON_EXPLAIN."<BR><BR></TD>\n";
		echo "					</TR>\n";	
		echo "					<TR>\n";
		echo "						<FORM NAME='icons' ACTION='admin.php?op=JAG_Admin&for=JAG_Online&do=add_new' METHOD='POST'>\n";
		echo "						<TD ALIGN='right' CLASS='content'>\n";
		echo "							<B>"._ICON_ADDN_USER.":</B> <INPUT TYPE='TEXT' NAME='icon_user'></TD>\n";
		echo "						<TD ALIGN='RIGHT' CLASS='content'>\n";
		echo "							<SELECT NAME='icon_image'>\n";
		
										$dir = opendir("images/blocks/JAG_Online");
										while ($file = readdir($dir))
											{		
											if (eregi(".gif", $file))
												{
												$file = explode(".", $file);
												$imgarray .= $file[0]."<-N->";	
												}
											}		
											
										$files = explode ("<-N->", $imgarray);
										sort($files);
										
										for ($i = 1; ($i < count($files)); $i++)
											{
											echo "					<OPTION VALUE='".$files[$i]."'>".eregi_replace("_", " ", $files[$i])."</OPTION>\n";
											}			
		
		echo "							</SELECT></TD>\n";
		echo "					</TR>\n";	
		echo "					<TR>\n";
		echo "						<TD ALIGN='RIGHT' COLSPAN='2'>\n";
		echo "							<INPUT TYPE='SUBMIT' VALUE='"._ICON_ADDN_BUTTON."'></TD>\n";
		echo "					</TR>\n";	
		echo "					<TR>\n";
		echo "						<TD COLSPAN='2'>\n";
		echo "							<BR></TD>\n";
		echo "					</TR>\n";	
		
		$Q92 = "SELECT icon_username, icon_image
				FROM ".$prefix."_jag_online_icons
				ORDER BY icon_image ASC, icon_username ASC";
		$R92 =  $db -> sql_query($Q92) or die("Bad Q92:".mysql_error());
		
		while (list($icon_username, $icon_image) = sql_fetch_row($R92))
			{
			echo "					<TR>\n";
			echo "						<TD ALIGN='right'>\n";
			echo "							<IMG SRC='images/blocks/JAG_Online/".$icon_image.".gif' WIDHT='27' HEIGHT='6'> -> $icon_username</TD>\n";
			echo "						<TD ALIGN='RIGHT'>\n";
			echo "							<A HREF='admin.php?op=JAG_Admin&for=JAG_Online&do=icon_del&icon_user=$icon_username'>"._ICON_ADDN_DEL."</A></TD>\n";
			echo "					</TR>\n";		
			}
																	
		echo "				</TABLE>\n";
		echo "			</TD>\n";		
		echo "		</TR>\n";
		echo "		</FORM>\n";
		echo "	</TABLE>\n";			
		}
		
	function IconAddNew()
		{
    	global $bgcolor2, $currentlang, $prefix, $user_prefix, $db, $icon_user, $icon_image, $do;
		
		$Q93 = "SELECT *
				FROM ".$prefix."_jag_online_icons
				WHERE icon_username = '$icon_user'";
		$R93 =  $db -> sql_query($Q93) or die("Bad Q93:".mysql_error());	
		
		if (!sql_fetch_row($R93))
			{
			$Q94 = "SELECT *
					FROM ".$user_prefix."_users
					WHERE username = '$icon_user'";
			$R94 =  $db -> sql_query($Q94) or die("Bad Q94:".mysql_error());	

			if (sql_fetch_row($R94))
				{
				$Q95 = "INSERT 	INTO ".$prefix."_jag_online_icons (icon_id, icon_username, icon_image) 
								VALUES ('', '$icon_user', '$icon_image');";
				$R95 =  $db -> sql_query($Q95) or die("Bad Q95:".mysql_error());	
				}
			}
		
		header("Location: admin.php?op=JAG_Admin&for=JAG_Online");
		}		
		
	function IconDelete()
		{
    	global $bgcolor2, $currentlang, $prefix, $db, $icon_user, $do;
		
		$Q96 = "SELECT *
				FROM ".$prefix."_jag_online_icons
				WHERE icon_username = '$icon_user'";
		$R96 =  $db -> sql_query($Q96) or die("Bad Q96:".mysql_error());	
		
		if (sql_fetch_row($R96))
			{
			$Q97 = "DELETE FROM ".$prefix."_jag_online_icons
					WHERE icon_username = '$icon_user'";
			$R97 =  $db -> sql_query($Q97) or die("Bad Q97:".mysql_error());	
			}
		
		header("Location: admin.php?op=JAG_Admin&for=JAG_Online");
		}		
		
	function CurrentSettings() 
		{
    	global $bgcolor2, $currentlang, $prefix, $db, $dbname;

		/* Get Config Settings For The Block ---------------------------------------- */
		$Q98 = "SELECT *
				FROM ".$prefix."_jag_online_config";
		$R98 =  $db -> sql_query($Q98) or die("Bad Q98:".mysql_error());
		$AdminCfg = sql_fetch_array($R98);
		
		$IP_DISABLED = "DISABLED";
		$table  = "".$prefix."_jag_online_iplookup"; 
		$tables = mysql_list_tables($dbname); 
		while (list($temp) = mysql_fetch_array($tables)) 
			{
			if($temp == $table) 		$IP_DISABLED = "";
			}	
			 
		echo "<BODY onload='CheckBoxStatus();'>\n";
		include_once ("includes/JAG_Online_Script.php");	
			
		echo "		<FORM NAME='disen' ACTION='admin.php' METHOD='POST'>\n";

		/* Main Preferences Section ------------------------------------------------- */
		echo "		<TR>\n";
		echo "			<TD WIDTH='100%' ALIGN='right' VALIGN='TOP'>\n";
		echo "				<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='CENTER'>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='2' CLASS='title'><B>"._PREF_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";

		echo "						<TD ALIGN='right' COLSPAN='2'>"._PREF_EXPLAIN.":<BR><BR></TD>\n";
		echo "					</TR>\n";

		/* The Select Box Code ------------------------------------------------------- */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							<NOBR>"._PREF_SECTION." A:</NOBR></TD>\n";
		echo "						<TD ALIGN='RIGHT'><NOBR>\n";				
		echo "							<SELECT NAME='Block1' onChange='CheckBoxStatus()'>\n";
		echo "								<OPTION VALUE='None' 	".CheckSelected($AdminCfg[Block1], 'None').">"._PREF_NONE."</OPTION>\n";		
		echo "								<OPTION VALUE='Login' 	".CheckSelected($AdminCfg[Block1], 'Login').">"._PREF_LOGIN."</OPTION>\n";
		echo "								<OPTION VALUE='PMS' 	".CheckSelected($AdminCfg[Block1], 'PMS').">"._PREF_PMS."</OPTION>\n";
		echo "								<OPTION VALUE='Members' ".CheckSelected($AdminCfg[Block1], 'Members').">"._PREF_MEMBERS."</OPTION>\n";
		echo "								<OPTION VALUE='Online' 	".CheckSelected($AdminCfg[Block1], 'Online').">"._PREF_ONLINE."</OPTION>\n";		
		echo "							</SELECT>\n";
		echo "							<SELECT NAME='Block1Show'>\n";
		echo "								<OPTION VALUE='All' 	".CheckSelected($AdminCfg[Block1Show], 'All').">"._PREF_ALL."</OPTION>\n";
		echo "								<OPTION VALUE='Mem' 	".CheckSelected($AdminCfg[Block1Show], 'Mem').">"._PREF_MEM."</OPTION>\n";
		echo "								<OPTION VALUE='Adm' 	".CheckSelected($AdminCfg[Block1Show], 'Adm').">"._PREF_ADM."</OPTION>\n";		
		echo "							</SELECT></TD>\n";
		echo "					</TR>\n";					
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							<NOBR>"._PREF_SECTION." B:</NOBR></TD>\n";
		echo "						<TD ALIGN='RIGHT' COLSPAN='1'><NOBR>\n";				
		echo "							<SELECT NAME='Block2' onChange='CheckBoxStatus()'>\n";
		echo "								<OPTION VALUE='None' 	".CheckSelected($AdminCfg[Block2], 'None').">"._PREF_NONE."</OPTION>\n";		
		echo "								<OPTION VALUE='Login' 	".CheckSelected($AdminCfg[Block2], 'Login').">"._PREF_LOGIN."</OPTION>\n";
		echo "								<OPTION VALUE='PMS' 	".CheckSelected($AdminCfg[Block2], 'PMS').">"._PREF_PMS."</OPTION>\n";
		echo "								<OPTION VALUE='Members' ".CheckSelected($AdminCfg[Block2], 'Members').">"._PREF_MEMBERS."</OPTION>\n";
		echo "								<OPTION VALUE='Online' 	".CheckSelected($AdminCfg[Block2], 'Online').">"._PREF_ONLINE."</OPTION>\n";		
		echo "							</SELECT>\n";
		echo "							<SELECT NAME='Block2Show'>\n";
		echo "								<OPTION VALUE='All' 	".CheckSelected($AdminCfg[Block2Show], 'All').">"._PREF_ALL."</OPTION>\n";
		echo "								<OPTION VALUE='Mem' 	".CheckSelected($AdminCfg[Block2Show], 'Mem').">"._PREF_MEM."</OPTION>\n";
		echo "								<OPTION VALUE='Adm' 	".CheckSelected($AdminCfg[Block2Show], 'Adm').">"._PREF_ADM."</OPTION>\n";		
		echo "							</SELECT></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='1'>\n";
		echo "							<NOBR>"._PREF_SECTION." C:</NOBR></TD>\n";
		echo "						<TD ALIGN='RIGHT' COLSPAN='1'><NOBR>\n";				
		echo "							<SELECT NAME='Block3' onChange='CheckBoxStatus()'>\n";
		echo "								<OPTION VALUE='None' 	".CheckSelected($AdminCfg[Block3], 'None').">"._PREF_NONE."</OPTION>\n";		
		echo "								<OPTION VALUE='Login' 	".CheckSelected($AdminCfg[Block3], 'Login').">"._PREF_LOGIN."</OPTION>\n";
		echo "								<OPTION VALUE='PMS' 	".CheckSelected($AdminCfg[Block3], 'PMS').">"._PREF_PMS."</OPTION>\n";
		echo "								<OPTION VALUE='Members' ".CheckSelected($AdminCfg[Block3], 'Members').">"._PREF_MEMBERS."</OPTION>\n";
		echo "								<OPTION VALUE='Online' 	".CheckSelected($AdminCfg[Block3], 'Online').">"._PREF_ONLINE."</OPTION>\n";		
		echo "							</SELECT>\n";
		echo "							<SELECT NAME='Block3Show'>\n";
		echo "								<OPTION VALUE='All' 	".CheckSelected($AdminCfg[Block3Show], 'All').">"._PREF_ALL."</OPTION>\n";
		echo "								<OPTION VALUE='Mem' 	".CheckSelected($AdminCfg[Block3Show], 'Mem').">"._PREF_MEM."</OPTION>\n";
		echo "								<OPTION VALUE='Adm' 	".CheckSelected($AdminCfg[Block3Show], 'Adm').">"._PREF_ADM."</OPTION>\n";		
		echo "							</SELECT></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='1'>\n";
		echo "							<NOBR>"._PREF_SECTION." D:</NOBR></TD>\n";
		echo "						<TD ALIGN='RIGHT' COLSPAN='1'><NOBR>\n";				
		echo "							<SELECT NAME='Block4' onChange='CheckBoxStatus()'>\n";
		echo "								<OPTION VALUE='None' 	".CheckSelected($AdminCfg[Block4], 'None').">"._PREF_NONE."</OPTION>\n";		
		echo "								<OPTION VALUE='Login' 	".CheckSelected($AdminCfg[Block4], 'Login').">"._PREF_LOGIN."</OPTION>\n";
		echo "								<OPTION VALUE='PMS' 	".CheckSelected($AdminCfg[Block4], 'PMS').">"._PREF_PMS."</OPTION>\n";
		echo "								<OPTION VALUE='Members' ".CheckSelected($AdminCfg[Block4], 'Members').">"._PREF_MEMBERS."</OPTION>\n";
		echo "								<OPTION VALUE='Online' 	".CheckSelected($AdminCfg[Block4], 'Online').">"._PREF_ONLINE."</OPTION>\n";		
		echo "							</SELECT>\n";
		echo "							<SELECT NAME='Block4Show'>\n";
		echo "								<OPTION VALUE='All' 	".CheckSelected($AdminCfg[Block4Show], 'All').">"._PREF_ALL."</OPTION>\n";
		echo "								<OPTION VALUE='Mem' 	".CheckSelected($AdminCfg[Block4Show], 'Mem').">"._PREF_MEM."</OPTION>\n";
		echo "								<OPTION VALUE='Adm' 	".CheckSelected($AdminCfg[Block4Show], 'Adm').">"._PREF_ADM."</OPTION>\n";		
		echo "							</SELECT></TD>\n";
		echo "					</TR>\n";		
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='2'>\n";
		echo "							<FONT COLOR='RED'>"._PREF_IMPORTANT_NOTE."<BR><BR></TD>\n";
		echo "					</TR>\n";
		echo "				</TABLE></TD>\n";
		echo "		</TR>\n";
		echo "		<TR>\n";
		echo "			<TD WIDTH='100%' ALIGN='right' VALIGN='TOP'>\n";
		echo "				<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='CENTER'>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5' CLASS='title'>\n";
		echo "							<B>"._INDI_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							"._INDI_EXPLAIN.":<BR><BR></TD>\n";
		echo "					</TR>\n";		

		/* Login Block Secition ------------------------------------------------------ */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<BR><B>"._INDI_LOGIN_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		
								CreateYesNo (_INDI_LOGIN_REGISTER, _YES, _NO, "show_login_register", "$AdminCfg[show_login_register]");
								CreateYesNo (_INDI_LOGIN_ADMIN, _YES, _NO, "show_login_admin", "$AdminCfg[show_login_admin]");
								CreateYesNo (_INDI_LOGIN_LOGOUT, _YES, _NO, "show_login_logout", "$AdminCfg[show_login_logout]");
	
		/* PMS Block Section -------------------------------------------------------- */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<BR><B>"._INDI_PMS_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							"._INDI_PMS_NOTE."<BR><BR></TD>\n";
		echo "					</TR>\n";
							
		/* Members Stats Secition --------------------------------------------------- */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<BR><B>"._INDI_MEM_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		
								CreateYesNo (_INDI_MEM_NEW_T, _YES, _NO, "show_memb_newt", "$AdminCfg[show_memb_newt]");
								CreateYesNo (_INDI_MEM_NEW_Y, _YES, _NO, "show_memb_newy", "$AdminCfg[show_memb_newy]");
								CreateYesNo (_INDI_MEM_TOTAL, _YES, _NO, "show_memb_total", "$AdminCfg[show_memb_total]");
								CreateYesNo (_INDI_MEM_LATEST, _YES, _NO, "show_memb_latest", "$AdminCfg[show_memb_latest]");

		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							"._INDI_MEM_LATEST_NUM.":</TD>\n";
		echo " 						<TD ALIGN='RIGHT' COLSPAN='4'>\n";
		echo "							<INPUT TYPE='TEXT' NAME='show_memb_latest_num' VALUE='$AdminCfg[show_memb_latest_num]' SIZE='5'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_MEM_LATEST_NOTE."<BR><BR></TD>\n";
		echo "					</TR>\n";
		
		/* Currently Online Secition ------------------------------------------------ */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<BR><B>"._INDI_CUR_TITLE.":</B></TD>\n";
		echo "					</TR>\n";

								CreateYesNo (_INDI_ONLINE_TOTAL, _YES, _NO, "show_online_total", "$AdminCfg[show_online_total]");

		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							&nbsp;\n";
		echo "						<TD ALIGN='CENTER' COLSPAN='4'>\n";
		echo "							<NOBR><B>"._INDI_MEM_OPTION."</B></NOBR></TD>\n";
		echo "					</TR>\n";
		
								CreateYesNo (_INDI_MEM, _YES, _NO, "show_mem", "$AdminCfg[show_mem]");
								CreateYesNo (_INDI_MEM_DETAIL_NUM, _YES, _NO, "show_mem_detail_num", "$AdminCfg[show_mem_detail_num]");
								CreateYesNo (_INDI_MEM_DETAIL_PER, _YES, _NO, "show_mem_detail_per", "$AdminCfg[show_mem_detail_per]");
								
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'><BR></TD>\n";
		echo "					</TR>\n";						
			
								CreateYesNo (_INDI_MEM_DETAIL, _YES, _NO, "show_mem_detail", "$AdminCfg[show_mem_detail]");
								
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							"._INDI_MEM_DETAIL_NAME_SIZE.":</TD>\n";
		echo " 						<TD ALIGN='RIGHT' COLSPAN='4'>\n";
		echo "							<INPUT TYPE='TEXT' NAME='show_mem_detail_name_size' VALUE='$AdminCfg[show_mem_detail_name_size]' SIZE='5'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_MEM_DETAIL_NAME_NOTE."</TD>\n";
		echo "					</TR>\n";
												
								CreateYesNo (_INDI_MEM_DETAIL_GROUP, _YES, _NO, "show_mem_detail_group", "$AdminCfg[show_mem_detail_group]");
								CreateYesNo (_INDI_MEM_DETAIL_FLAG, _YES, _NO, "show_mem_detail_flag", "$AdminCfg[show_mem_detail_flag]");

		echo "					<TR>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							"._INDI_MEM_DETAIL_FLAG_AUTO."</TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							"._YES."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_mem_detail_flag_auto' VALUE='1' ".CheckStatus($AdminCfg[show_mem_detail_flag_auto], 1)." $IP_DISABLED></TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							&nbsp;"._NO."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_mem_detail_flag_auto' VALUE='0' ".CheckStatus($AdminCfg[show_mem_detail_flag_auto], 0)." $IP_DISABLED></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_MEM_DETAIL_AUTO_NOTE."</TD>\n";
		echo "					</TR>\n";

								CreateYesNo (_INDI_MEM_DETAIL_LOCA, _YES, _NO, "show_mem_detail_loca", "$AdminCfg[show_mem_detail_loca]");

		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'><BR></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							&nbsp;\n";
		echo "						<TD ALIGN='CENTER' COLSPAN='4'>\n";
		echo "							<NOBR><B>"._INDI_GUE_OPTION."</B></NOBR></TD>\n";
		echo "					</TR>\n";
	
								CreateYesNo (_INDI_GUE, _YES, _NO, "show_gue", "$AdminCfg[show_gue]");
								CreateYesNo (_INDI_GUE_DETAIL_NUM, _YES, _NO, "show_gue_detail_num", "$AdminCfg[show_gue_detail_num]");
								CreateYesNo (_INDI_GUE_DETAIL_PER, _YES, _NO, "show_gue_detail_per", "$AdminCfg[show_gue_detail_per]");	

		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'><BR></TD>\n";
		echo "					</TR>\n";

								CreateYesNo (_INDI_GUE_DETAIL, _YES, _NO, "show_gue_detail", "$AdminCfg[show_gue_detail]");
								CreateYesNo (_INDI_GUE_DETAIL_IPADD, _YES, _NO, "show_gue_detail_ipadd", "$AdminCfg[show_gue_detail_ipadd]");
								
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_GUE_DETAIL_IPADD_NOTE."</TD>\n";
		echo "					</TR>\n";	
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							"._INDI_GUE_DETAIL_FLAG."</TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							"._YES."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_gue_detail_flag' VALUE='1' ".CheckStatus($AdminCfg[show_gue_detail_flag], 1)." $IP_DISABLED></TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							&nbsp;"._NO."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_gue_detail_flag' VALUE='0' ".CheckStatus($AdminCfg[show_gue_detail_flag], 0)." $IP_DISABLED></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_MEM_DETAIL_AUTO_NOTE."</TD>\n";
		echo "					</TR>\n";
		
								CreateYesNo (_INDI_GUE_DETAIL_LOCA, _YES, _NO, "show_gue_detail_loca", "$AdminCfg[show_gue_detail_loca]");
								
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'><BR></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							&nbsp;\n";
		echo "						<TD ALIGN='CENTER' COLSPAN='4'>\n";
		echo "							<NOBR><B>"._INDI_SPD_OPTION."</B></NOBR></TD>\n";
		echo "					</TR>\n";
			
								CreateYesNo (_INDI_SPD, _YES, _NO, "show_spd", "$AdminCfg[show_spd]");
								CreateYesNo (_INDI_SPD_DETAIL_NUM, _YES, _NO, "show_spd_detail_num", "$AdminCfg[show_spd_detail_num]");
								CreateYesNo (_INDI_SPD_DETAIL_PER, _YES, _NO, "show_spd_detail_per", "$AdminCfg[show_spd_detail_per]");	

		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'><BR></TD>\n";
		echo "					</TR>\n";	
									
								CreateYesNo (_INDI_SPD_DETAIL, _YES, _NO, "show_spd_detail", "$AdminCfg[show_spd_detail]");
								CreateYesNo (_INDI_SPD_DETAIL_QTY, _YES, _NO, "show_spd_detail_qty", "$AdminCfg[show_spd_detail_qty]");

		echo "					<TR>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							"._INDI_SPD_DETAIL_FLAG."</TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							"._YES."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_spd_detail_flag' VALUE='1' ".CheckStatus($AdminCfg[show_spd_detail_flag], 1)." $IP_DISABLED></TD>\n";
		echo "						<TD ALIGN='RIGHT' VALIGN='MIDDLE'>\n";
		echo "							&nbsp;"._NO."</TD>\n";
		echo "						<TD ALIGN='right' VALIGN='MIDDLE'>\n";
		echo "							<INPUT TYPE='RADIO' NAME='show_spd_detail_flag' VALUE='0' ".CheckStatus($AdminCfg[show_spd_detail_flag], 0)." $IP_DISABLED></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._INDI_MEM_DETAIL_AUTO_NOTE."</TD>\n";
		echo "					</TR>\n";
		
								CreateYesNo (_INDI_SPD_DETAIL_LOCA, _YES, _NO, "show_spd_detail_loca", "$AdminCfg[show_spd_detail_loca]");

		echo "				</TABLE>\n";
		echo "			</TD>\n";
		echo "		</TR>\n";
		echo "		<TR>\n";
		echo "			<TD WIDTH='100%' ALIGN='right' VALIGN='TOP'>\n";
		echo "				<BR><TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='CENTER'>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5' CLASS='title'>\n";
		echo "							<B>"._MAIN3_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							"._MAIN3_EXPLAIN."<BR><BR></TD>\n";
		echo "					</TR>\n";
		
		/* Misc Detail ---------------------------------------------------------------- */
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' WIDTH='100%'>\n";
		echo " 							"._MISC_MAX_MODULE."</TD>\n";
		echo " 						<TD ALIGN='RIGHT'>\n";
		echo " 							<INPUT TYPE='TEXT' NAME='show_mem_detail_modu_size' VALUE='$AdminCfg[show_mem_detail_modu_size]' SIZE='5'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._MISC_MAX_MODULE_NOTE."<BR><BR></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							"._MISC_PAST_TIME."</TD>\n";
		echo " 						<TD ALIGN='RIGHT'>\n";
		echo "							<INPUT TYPE='TEXT' NAME='past_time' VALUE='$AdminCfg[past_time]' SIZE='5'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right'>\n";
		echo "							"._MISC_MODULE_ADMIN."</TD>\n";
		echo " 						<TD ALIGN='RIGHT'>\n";
		echo "							<INPUT TYPE='TEXT' NAME='show_module_unknown' VALUE='$AdminCfg[show_module_unknown]' SIZE='20'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							<FONT COLOR='RED'>"._MISC_MODULE_ADMIN_NOTE."<BR><BR></TD>\n";
		echo "					</TR>\n";
		echo "				</TABLE></TD>\n";
		echo "		</TR>\n";
		echo "		<TR>\n";
		echo "			<TD WIDTH='100%'>\n";
		echo "				<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='2' ALIGN='right' WIDTH='100%'>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5' CLASS='title' WIDTH='100%'>\n";
		echo "							<B>"._MAIN4_TITLE.":</B></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='right' COLSPAN='5'>\n";
		echo "							"._MAIN4_EXPLAIN."<BR><BR></TD>\n";
		echo "					</TR>\n";
		echo "					<TR>\n";
		echo "						<TD ALIGN='RIGHT' COLSPAN='5'>\n";
		echo "							<BR><INPUT TYPE='HIDDEN' NAME='op' VALUE='JAG_Admin'>\n";
		echo "								<INPUT TYPE='HIDDEN' NAME='for' VALUE='JAG_Online'>\n";
		echo "								<INPUT TYPE='SUBMIT' NAME='do' VALUE='update'>&nbsp;&nbsp;&nbsp;</TD>\n";
		echo "					</TR>\n";
		echo "				</TABLE>\n";
		echo "			</TD>\n";		
		echo "		</TR>\n";
		echo "	</TABLE>\n";			
		}

	function UpdateSettings()
		{
		global 	$db, $prefix;
		global 	$Block1, $Block1Show, $Block2, $Block2Show, $Block3, $Block3Show, $Block4, $Block4Show, $show_login_register, 
				$show_login_logout, $show_login_admin, $show_memb_newt, $show_memb_newy, $show_memb_total, $show_memb_latest, 
				$show_memb_latest_num, $show_online_total, $show_mem, $show_mem_detail, $show_mem_detail_num, 
				$show_mem_detail_per, $show_mem_detail_name_size, $show_mem_detail_group, $show_mem_detail_flag, 
				$show_mem_detail_flag_auto, $show_mem_detail_loca, $show_mem_detail_modu_size, $show_gue, $show_gue_detail, 
				$show_gue_detail_num, $show_gue_detail_per, $show_gue_detail_you, $show_gue_detail_ipadd, $show_gue_detail_flag, 
				$show_gue_detail_loca, $show_spd, $show_spd_detail, $show_spd_detail_num, $show_spd_detail_per, 
				$show_spd_detail_qty, $show_spd_detail_flag, $show_spd_detail_loca, $show_module_unknown, $past_time;

		if ($Block1 == "Login") 	$Block1Show = "All";
		if ($Block1 == "PMS")		$Block1Show = "Mem";
		if ($Block2 == "Login") 	$Block2Show = "All";
		if ($Block2 == "PMS")		$Block2Show = "Mem";
		if ($Block3 == "Login") 	$Block3Show = "All";
		if ($Block3 == "PMS")		$Block3Show = "Mem";
		if ($Block4 == "Login") 	$Block4Show = "All";
		if ($Block4 == "PMS")		$Block4Show = "Mem";
		
 		$Q99 = "UPDATE ".$prefix."_jag_online_config
				SET Block1 = '$Block1', Block1Show = '$Block1Show', Block2 = '$Block2', Block2Show = '$Block2Show', 
					Block3 = '$Block3', Block3Show = '$Block3Show', Block4 = '$Block4', Block4Show = '$Block4Show', 
					show_login_register = '$show_login_register', show_login_admin = '$show_login_admin', show_login_logout = '$show_login_logout', 
					show_memb_newt = '$show_memb_newt', show_memb_newy = '$show_memb_newy', show_memb_total = '$show_memb_total',
					show_memb_latest = '$show_memb_latest', show_memb_latest_num = '$show_memb_latest_num', 
					show_online_total = '$show_online_total', show_mem = '$show_mem', show_mem_detail = '$show_mem_detail', 
					show_mem_detail_num = '$show_mem_detail_num', show_mem_detail_per = '$show_mem_detail_per', 
					show_mem_detail_name_size = '$show_mem_detail_name_size', show_mem_detail_group = '$show_mem_detail_group',
					show_mem_detail_flag = '$show_mem_detail_flag', show_mem_detail_flag_auto = '$show_mem_detail_flag_auto', 
					show_mem_detail_loca = '$show_mem_detail_loca', show_mem_detail_modu_size = '$show_mem_detail_modu_size', 
					show_gue = '$show_gue', show_gue_detail = '$show_gue_detail', show_gue_detail_num = '$show_gue_detail_num', 
					show_gue_detail_per = '$show_gue_detail_per', 
					show_gue_detail_ipadd = '$show_gue_detail_ipadd', show_gue_detail_flag = '$show_gue_detail_flag', 
					show_gue_detail_loca = '$show_gue_detail_loca', show_spd = '$show_spd', show_spd_detail = '$show_spd_detail', 
					show_spd_detail_num = '$show_spd_detail_num', show_spd_detail_per = '$show_spd_detail_per', 
					show_spd_detail_qty = '$show_spd_detail_qty', show_spd_detail_flag = '$show_spd_detail_flag', show_spd_detail_loca = '$show_spd_detail_loca', 
					show_module_unknown = '$show_module_unknown', past_time = '$past_time'";
		$R99 =  $db -> sql_query($Q99) or die("Bad Q99:".mysql_error());
				
	    header("Location: admin.php?op=JAG_Admin&for=JAG_Online&do=pref");
		}
	
	switch ($do)
		{
	    case "update":
		    UpdateSettings();
	    break;
		
		case "add_new":
			IconAddNew();
		break;
				
		case "icon_del":
			IconDelete();
		break;
		
	    case "pref":
		    CurrentSettings();
	    break;
		
	    default:
		    CurrentIcons();
	    break;
		}
	} 
else 
	{
    echo "Access Denied";
	}
?>
