Hacked By AnonymousFox

Current Path : C:/AppServ/www/mfu/webengine/mod_s1/
Upload File :
Current File : C:/AppServ/www/mfu/webengine/mod_s1/index-01.php

<? 
include("../lib/session.php"); 
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html><!-- InstanceBegin template="/Templates/WebEngine-Adminpanel1.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Web Engine : 
<?=$System_Variable_Title?>
</title>
<!-- InstanceEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> 
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">  
</head> 
<body bgcolor="#E9E6DF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../../images/thai.gif','../../images/eng.gif','../../images/chaina.gif','../../images/object/topbar-thai-over.gif','../../images/object/topbar-english-over.gif','../images/bullet/lang_over_02_1.gif','../images/bullet/lang_over_01_1.gif','../images/bullet/lang_over_03.gif')">

<table width="95%" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td background="../../images/main/main-t-bg.gif" bgcolor="#831B0E"><table width="100%" height="26" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="867" valign="top"><img src="../../images/main/logo.gif" width="273" height="70" alt="กระทรวงศึกษาธิการ" />&nbsp;</td>
            <td width="115" align="right" valign="top"><a href="../system/setlanguage.php?setlang=Thai&&action=setlanguage" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('TopBarTh','','../images/bullet/lang_over_04.gif',1)"><? if($System_Session_Language=="Thai"){$Use = "_over";} else { $Use = "_nor";}?><img src="../images/bullet/lang<?=$Use?>_04.gif" alt="Thai Language" name="TopBarTh" border="0"></a><a href="../system/setlanguage.php?setlang=Eng&&action=setlanguage" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('TopBarEn','','../images/bullet/lang_over_03.gif',1)"><? if($System_Session_Language=="Eng"){$Use = "_over";} else { $Use = "_nor";}?>
                <img src="../images/bullet/lang<?=$Use?>_03.gif" alt="English Language" name="TopBarEn"border="0"></a> </td>
          </tr>
    </table></td><td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" height="6" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="587" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td align="center" valign="top"><table width="100%" height="480" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="215" align="center" valign="top" bgcolor="#9C9994" style="background-repeat:repeat-x; "><br>
            <!--Start Menu ----------------------------------------------------------------------------------->
        	<? if(strlen($System_Session_User_ID)==0) { ?>
            <? if($alert=="yes") { ?>
            <table width="90%" border="0" cellpadding="1" cellspacing="0" class="messagebox_alert">
              <form name="myLoginForm" method="post" action="../../system/login.php" onSubmit="
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}">
                <tr align="center"> 
                  <td height="40" colspan="2">Incorrect your<br>
                    UserName or Password.</td>
                </tr>
              </form>
            </table>
            <br>
            <? } ?>            
            <table width="97%" height="18" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="8"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td ><strong><font color="#FFFFFF">&nbsp;<img src="../../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เข้าสู่ระบบ</font></strong></td>
              </tr>
            </table> 
            <table width="100%" height="3" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td><img src="../../images/blank.gif" width="1" height="1"></td>
              </tr>
            </table>
            <table width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DFDFDF">
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-1.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-2.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-3.gif" width="6" height="6"></td>
              </tr>
              <tr> 
                <td width="6" background="../../images/object/dot-border-4.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td align="center" valign="top">
<table width="100%" height="120" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="80" align="center" valign="middle"> 
                        <form name="myLoginForm" method="post" action="../system/login.php" onSubmit=" 
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}
				">
                          <table border="0" cellspacing="0" cellpadding="1">
                            <tr> 
                              <td height="18" colspan="2" valign="bottom"><font color="#990000"><strong>Username</strong></font><font color="#990000">&nbsp;</font></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td> <input name="inputUserName" type="text" class="input_left" id="inputUserName" size="20" maxlength="50"></td>
                            </tr>
                            <tr> 
                              <td height="18" colspan="2" valign="bottom"><font color="#990000"><strong>Password</strong></font><font color="#990000">&nbsp;</font></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td><input name="inputPassword" type="password" class="input_left" id="inputPassword" size="20" maxlength="50"></td>
                            </tr>
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td align="right"><input name="Submit" type="submit" class="button_60" value="LogIn"></td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                  </table></td>
                <td width="6" background="../../images/object/dot-border-5.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
              </tr>
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-6.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-7.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-8.gif" width="6" height="6"></td>
              </tr>
            </table>
            <br>
            <? } else { ?>
            <? if($SystemMenuID=="") { $SystemMenuID=-1; } ?>
            <table width="205" height="21" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search.gif" style="background-repeat:repeat-x; ">
              <tr>
                <td width="5%" >&nbsp;</td> 
                <td width="95%" height="43" ><strong><font color="#FFFFFF">&nbsp;<img src="../../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เมนูหลัก</font></strong></td>
              </tr>
            </table> 
            <table width="205" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td bgcolor="#F3F3F3"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <form action="../../Templates/" method="get" name="myMenuForm" id="myMenuForm">
                      <input type="hidden" name="SystemMenuID">
                      <input type="hidden" name="SystemModuleKey">
                      <input type="hidden" name="System_EXID" value="<?=$System_EXID?>">
                    </form>
                    <? if($System_Session_User_ID>0) { ?> 
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr>
                      <td height="1" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../home/index.php'; document.myMenuForm.submit();">
					  <table width="100%" height="24" border="0" cellpadding="2" cellspacing="0" class="menu_table_text">
        <tr>
          <td width="22" align="center"><img src="../images/icon/ico516.gif" width="16" height="14"></td>
          <td>Home</td>
        </tr>
    </table></td>
                    </tr>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_information.php'; 
document.myMenuForm.SystemMenuID.value=-3;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico559.gif" width="15" height="16"></td>
                            <td> 
                              <? if($SystemMenuID==-3) { ?>
                              <b><font color="#990000">User Information</font></b> 
                              <? } else { ?>
                              User Information 
                              <? } ?>
                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_Level=="Admin") { ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_management.php'; 
document.myMenuForm.SystemMenuID.value=-4;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico051.gif" width="13" height="19"></td>
                            <td> 
                              <? if($SystemMenuID==-4) { ?>
                              <b><font color="#990000">Manage User Admin</font></b> 
                              <? } else { ?>
                              Manage User Admin 
                              <? } ?>
                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_User_ID==0) { ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../mod_dmenu/index.php'; 
document.myMenuForm.SystemMenuID.value=-2;
document.myMenuForm.submit();
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico509.gif" width="16" height="13"></td>
                            <td> 
                              <? if($SystemMenuID==-2) { ?>
                              <b><font color="#990000">Menu Bulider</font></b> 
                              <? } else { ?>
                              Menu Bulider 
                              <? } ?>
                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <? if($System_Session_User_ID>0) { ?>
                    <?
$sql = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID=0 AND ".$System_TableName_Menu."_Language = '$System_Session_Language' ORDER BY ".$System_TableName_Menu."_Order ASC ";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$MenuRecordCount=MYSQL_NUMROWS($Query);

$index=1;
if($MenuRecordCount>0) {
	while($index<$MenuRecordCount+1) {
		$Row=MYSQL_FETCH_ARRAY($Query);
		
		// checking for User Permission
		
		$myUserID = $System_Session_User_ID;
		$myMenuID = $Row[$System_TableName_Menu."_ID"];
		$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);

		if($Row[$System_TableName_Menu."_Type"]=="Group") {
			$isUserOnGroup=isUserOnGroup($myUserID,$myMenuID);
		} else {
			$isUserOnGroup=1;
		}
		if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA" && $isUserOnGroup>0) {
		?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
<? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
	menuHideSubShow('idMenuSub<?=$Row[$System_TableName_Menu."_ID"]?>');
<? } else { ?>
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
<? } ?>
"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><? if($Row[$System_TableName_Menu."_Icon"]==""){ ?>
                              <img src="../images/icon/145.gif">							<? }else{ ?>
							<img src="<?=$Row[$System_TableName_Menu."_Icon"]?>"><? } ?></td>
                            <td> 
                              <? if($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>
                              <b><font color="#990000"> 
                              <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                              </font></b> 
                              <? } else { ?>
                              <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                              <? } ?>
                            </td>
                            <? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
                            <td width="14" align="left"><img src="../images/arrow1.gif" width="13" height="10"></td>
                            <? } ?>
                          </tr>
                        </table></td>
                    </tr>
                    <?
		$ParentID=$Row[$System_TableName_Menu."_ID"];
		
		$sql1 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID='$ParentID' ORDER BY ".$System_TableName_Menu."_Order ASC ";
		$Query1=MYSQL_DB_QUERY($System_DataBase_Name,$sql1) OR DIE("Error: เกิดความผิดพลาด <br>$sql1<br>\n");
		$RecordCount1=MYSQL_NUMROWS($Query1);
	
		// checking for this sub menu active
		$sql2 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ID='$SystemMenuID' AND ".$System_TableName_Menu."_ParentID='$ParentID' ";
		
		$Query2=MYSQL_DB_QUERY($System_DataBase_Name,$sql2) OR DIE("Error: เกิดความผิดพลาด <br>$sql2<br>\n");
		$isActiveMenu=MYSQL_NUMROWS($Query2);

		if($RecordCount1>0) {
		?>
                    <tr id="idMenuSub<?=$ParentID?>" <? if($isActiveMenu==0) { ?> style="display:none" <? } ?>> 
                      <td height="22" align="left" class="menu_table_bg_sub" > 
                        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr height="8" >
                            <td height="8" background="../images/rare1.gif" bgcolor="#EACFD3" style="background-position:top; background-repeat:repeat-x; "><img src="../images/spacer.gif" width="24" height="8" /></td>
</tr>
</table><?
		$index1=1;
		
		while($index1<$RecordCount1+1) {
			$Row1=MYSQL_FETCH_ARRAY($Query1);
			$myID=$Row1[$System_TableName_Menu."_ID"];

			// checking for User Permission
			$myUserID = $System_Session_User_ID;
			$myMenuID = $myID;
			$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);
			if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA") {

				?>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="menu_table_bg_sub" onMouseOver="this.className='menu_table_bg_oversub'; " onMouseOut="this.className='menu_table_bg_sub'; " >
                          <tr> 
                            <td width="4">&nbsp;</td>
                            <td width="171" align="left"><table width="100%" height="25" border="0" cellpadding="1" cellspacing="0"  
 onClick="
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row1[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row1[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row1[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
">
                                <tr> 
                                  <td width="22" align="left"><? if($Row1[$System_TableName_Menu."_Icon"]==""){ ?>-<? }else{ ?><img src="<?=$Row1[$System_TableName_Menu."_Icon"]?>"><? }?></td>
                                  <td align="left"> 
                                    <? if($SystemMenuID==$Row1[$System_TableName_Menu."_ID"]) { ?>
                                    <b><font color="#990000"> 
                                    <?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?>
                                    </font></b> 
                                    <? } else { ?>
							  <font color="#6666AA"><?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?></font>
                                    <? } ?>                                  </td>
                                </tr>
                            </table></td>
                          </tr>
                          <tr align="left">
                            <td colspan="2"><img src="../images/line3.gif" width="195"></td>
                          </tr>
                        </table>
                      <? 
					} // if Permission
					$index1++;
				} // while
			 } // if RecordCount1
			 ?>                      </td>
                    </tr>
                    <?
		} // if myMenuPermission
		$index++;
	} // while
} // if RecordCount
?>
                    <? } ?>
                    <tr> 
                      <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../system/logout.php'; document.myMenuForm.submit();"><table width="100%" height="25" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico569.gif" width="13" height="13"></td>
                            <td>Logout</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
            </table></td>
              </tr>
            </table>
            
            <table width="205" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search2.gif">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <? } ?>
            <script language="JavaScript" type="text/JavaScript">
function menuHideSubShow(myIdName) {
	if(document.getElementById(myIdName).style.display=='none') { 
		document.getElementById(myIdName).style.display=''
	} else {
		document.getElementById(myIdName).style.display='none';
	}
}
			  </script>
          <!--End Menu ----------------------------------------------------------------------------------->          </td>
          <td align="center" valign="top" bgcolor="#E9E6DF"> 
            <table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="16" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td align="center" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td valign="top" bgcolor="#C4BDB1">&nbsp;</td>
      </tr>
      <tr>
        <td width="20" valign="top" background="../images/object/border_03.gif"><img src="../images/object/border_16.gif" width="20" height="83"></td>
        <td align="center" valign="top" bgcolor="#FFFFFF">
		   <? if(strlen($System_Session_User_ID)>0) { ?>
            <!-- InstanceBeginEditable name="Programmable Region" -->
	   
                  <br>
                  <table width="95%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
                    <tr> 
                      <td width="30" align="center"><img src="<?=getMenuIcon($SystemMenuID)?>"></td>
                      <td>
                        <?=getMenuName($SystemMenuID)?>
                        &nbsp;
                        <script type="text/javascript" src="lib/calendar.js"></script></td>
                    </tr>
                  </table>
				  <table width="94%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="1" class="table_col3"><img src="../images/blank.gif" width="10" height="2"></td>
                    </tr>
                    <form action="?" method="get" name="myPageRedirectForm" id="myPageRedirectForm">
                      <input name="GroupID" type="hidden" id="GroupID" value="<?=$GroupID?>">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <tr>
                        <td height="21" align="right">
                          <table height="20" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="5" align="left" valign="bottom" class="table_col3"><img src="image/tab-w.gif" width="1" height="1"></td>
                              <td width="100" align="center" class="table_col3"><a href="#" onClick="
document.myPageRedirectForm.action='index.php';
document.myPageRedirectForm.submit();
								"><font color="#660000">Member</font></a></td>
                              <td width="20" class="table_col3"><img src="images/tab-w-slop-down.gif" width="20" height="20"></td>
						      <td align="left"  width="5" valign="bottom" ><img src="images/tab-w.gif" width="1" height="1" class="table_col3"></td>
                            </tr>
                        </table></td>
                      </tr>
                    </form>
		    </table>
				  <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                  <br>
                  <br>
                  <? 
## Load Module Configuration Variable ############################################

include("config.php");

## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "DESC";
//$myModule_Table = $myModule_Table1;
$SystemModule_OrderBy = $myModule_Table."_CreateDate";
#########################################################
?>
<script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                  <!-- import the calendar script -->
                  <link rel="stylesheet" type="text/css" href="../css/myCalendarStyle.css">
                  <script type="text/javascript" src="lib/lang/calendar-th.js"></script>
                  <script type="text/javascript" src="lib/loadcalendar.js"></script>
                  <!-- end the calendar script -->
<? 
if($action=="checkuser"){
	$sql="SELECT ".$myModule_Table."_User FROM ".$myModule_Table." WHERE ".$myModule_Table."_User='".$inputUser."'" ;
	$query=mysql_query($sql);
	if($row=mysql_fetch_array($query)){
?>		
	<script language="javascript">
		alert("ชื้อผู้ใช้ นี้มีอยู่แล้วในระบบ กรุณากรอกใหม่");
	</script>
<?		
		$action = "add";
	}else{
		$action = "addnew";
	}
	
}
####################################################################
if($action=="view") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM ".$myModule_Table." WHERE ". $myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$inputPass = $Row[$myModule_Table."_Pass"];
	$inputID = $Row[$myModule_Table."_member_ID"];
	$inputUser = $Row[$myModule_Table."_User"];
	$inputFName = $Row[$myModule_Table."_FName"];
	$inputLName = $Row[$myModule_Table."_LName"];
	$inputGender = $Row[$myModule_Table."_Gender"];
	$inputGroup = $Row[$myModule_Table."_Group"];
	$inputAddress = $Row[$myModule_Table."_HomeTown"];
	$inputCityID = $Row[$myModule_Table."_CityID"];
	$inputPostalCode = $Row[$myModule_Table."_PostalCode"];
	$inputPhone = $Row[$myModule_Table."_Phone"];
	$BirthArr=explode('-',$Row[$myModule_Table."_BirthDate"]);
	$inputDate=$BirthArr[2];
	$inputMonth=$BirthArr[1];
	$inputYear=$BirthArr[0];
	
	$inputBirthDate = $Row[$myModule_Table."_BirthDate"];
	?>
                  <br>
                  <table width="90%" border="0" cellpadding="0" cellspacing="0">
                    <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action" value="">
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					  <input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					  <input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                    </form>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action" value="edit">
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					  <input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
                      <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                      <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">
					  <input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                      <tr> 
                        <td  bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">View 
                                <?=getMenuName($SystemMenuID)?>
                              </td>
                            </tr>
                          </table>
						<table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_border">
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลระบบ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ชื่อผู้ใช้ &nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputUser?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> รหัสผ่าน *&nbsp;</td>
                                    <td height="22" class="table_col2"> <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                    <?=decodeStr($inputPass)?><? } else {?> &lt;&lt; hidden &gt;&gt; <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลส่วนตัว</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> เพศ &nbsp;&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><? if ($inputGender=="F") {echo "หญิง"; } elseif($inputGender=="M") {echo "ชาย"; }?></td>
                                  </tr>
                                  <tr>
                                    <td width="22%" height="22" align="right" class="table_col1"> ชื่อ *&nbsp;</td>
                                    <td width="78%" height="22" class="table_col2"><?=$inputFName?></td>
                                  </tr>
                                  <tr>
                                    <td width="22%" height="22" align="right" class="table_col1">นามสกุล *&nbsp; </td>
                                    <td width="78%" height="22" class="table_col2"><?=$inputLName?></td>
                                  </tr>
                                 <tr>
                                    <td height="22" align="right" class="table_col1">Email *&nbsp; </td>
                                    <td height="22" class="table_col2"><?=$inputUser?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">เบอร์โทรศัพท์&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputPhone?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันเกิด &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><? if ($inputBirthDate<>"0000-00-00") echo ShowDateLong($inputBirthDate); ?></td>
                                  </tr>
								  <tr>
                                    <td height="22" align="right" class="table_col1">กลุ่ม&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputGroup?> GROUP </td>
                                  </tr>
								   <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่ &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputAddress?></td>
                                  </tr>
								  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2">
									
                                      <?
					$sql = "SELECT ".$System_TableName_Province."_Nameth FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_ID=$inputCityID " ;
					$Query_City = mysql_query($sql);
					$Row_City = mysql_fetch_array($Query_City);
					echo $Row_City[$System_TableName_Province."_Nameth"];
					?>
</tr>
								   <tr>
                                    <td height="22" align="right" class="table_col1">รหัส&nbsp;ไปรษณีย์&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputPostalCode?></td>
                                  </tr>
								
								  </table></td>
                              </tr>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <tr align="right"> 
                              <td height="30" colspan="4" align="center" class="table_footer"> 
                                <table width="300" border="0" cellspacing="0" cellpadding="2">
                                  <tr align="center"> 
								  <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                  <td><input name="btEdit" type="submit" class="button_80" id="btEdit" value="Edit" onClick="
document.myForm.action.value='edit';
document.myForm.submit();
						"></td>
						<? }?>
                                  <td><input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="

	document.myReturnForm.submit();

						" value="Back"></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table>
                  <br>
              
                  <br>
<script language="JavaScript">
HideCheckBox();
function HideCheckBox() {
	for( i =0; i < document.myForm.elements.length; i++ ) {
			//  hide check box
			if( document.myForm.elements[ i ].type.toLowerCase( ) == "checkbox" ) {
				document.myForm.elements[ i ].disabled=true;
			}
	}
}
</script>				  
                  <? 
####################################################################
} else if($action=="edit") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM ".$myModule_Table." WHERE " .$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$inputPass = $Row[$myModule_Table."_Pass"];
	$inputID = $Row[$myModule_Table."_member_ID"];
	$inputUser = $Row[$myModule_Table."_User"];
	$inputFName = $Row[$myModule_Table."_FName"];
	$inputLName = $Row[$myModule_Table."_LName"];
	$inputGender = $Row[$myModule_Table."_Gender"];
	$inputGroup = $Row[$myModule_Table."_Group"];
	$inputAddress = $Row[$myModule_Table."_HomeTown"];
	$inputCityID = $Row[$myModule_Table."_CityID"];
	$inputPostalCode = $Row[$myModule_Table."_PostalCode"];
	$inputPhone = $Row[$myModule_Table."_Phone"];
	$inputDate=$BirthArr[2];
	$inputMonth=$BirthArr[1];
	$inputYear=$BirthArr[0];
	?>
	                  <br>
                  <table width="90%" border="0" cellpadding="0" cellspacing="0" >
                    <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
						<input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
						<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
						<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                    </form>
                    <form action="?" method="post" enctype="multipart/form-data" name="myForm" id="myForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
						<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
                        <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
						<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                      <tr> 
                        <td bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">Edit <?=getMenuName($SystemMenuID)?></td>
                            </tr>
                          </table>
                          <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_border">
                              <tr><td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลระบบ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ชื่อผู้ใช้ &nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <?=$inputUser?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> รหัสผ่าน *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputPass" type="password" class="input_left" id="inputPass" size="20"  maxlength="30" >
&nbsp;&nbsp;* ความยาวอย่างน้อย 4 ตัวอักษร </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ใส่รหัสผ่านอีกครั้ง *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputConfirm" type="password" class="input_left" id="inputConfirm" size="20"  maxlength="30" ></td></tr>
                                  <tr>
								  
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลส่วนตัว</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">เพศ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputGender" id="radio" type="radio" value="Male" <? if ($Row[$myModule_Member."_Gender"]=="M") echo "checked"; ?>>
ชาย &nbsp;&nbsp;
<input name="inputGender" id="radio" type="radio" value="Female" <? if ($Row[$myModule_Member."_Gender"]=="F") echo "checked"; ?>>
หญิง</td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1"> ชื่อ *&nbsp;</td>
                                    <td width="72%" height="22" class="table_col2">
                                      <input name="inputFName" type="text"   class="input_left" id="inputFName" value="<?=$inputFName?>" size="30" maxlength="30" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1">นามสกุล *&nbsp; </td>
                                    <td width="72%" height="22" class="table_col2"><input name="inputLName" type="text"   class="input_left" id="inputLName" value="<?=$inputLName?>" size="30" maxlength="30"></td>
                                  </tr>
                                  <!--------------tr>
                                    <td height="22" align="right" class="table_col1">ชื่อเล่น &nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputNickName" type="text"   class="input_left" id="inputNickName" value="<?=$inputNickName?>" size="30" maxlength="30"></td>
                                  </tr---------------------->
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันเกิด &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2">&nbsp;วัน&nbsp;&nbsp;
                                        <select name="inputDate" class="select">
                                          <? for($i=1;$i<=31;$i++){
									  			if ($i<10) $myi = "0".$i;
												else $myi = $i;
									  ?>
                                          <option value="<?=$myi?>">
                                          <?=$myi?>
                                          </option>
                                          <? }?>
                                        </select>
                                  &nbsp;&nbsp;เดือน&nbsp;&nbsp;
                                        <select name="inputMonth" class="select">
                                          <option value="01">มกราคม</option>
                                          <option value="02">กุมภาพันธ์</option>
                                          <option value="03">มีนาคม</option>
                                          <option value="04">เมษายน</option>
                                          <option value="05">พฤษภาคม</option>
                                          <option value="06">มิถุนายน</option>
                                          <option value="07">กรกฎาคม</option>
                                          <option value="08">สิงหาคม</option>
                                          <option value="09">กันยายน</option>
                                          <option value="10">ตุลาคม</option>
                                          <option value="11">พฤศจิกายน</option>
                                          <option value="12">ธันวาคม</option>
                                        </select>
                                  &nbsp;&nbsp;ปี&nbsp;&nbsp;
                                        <select name="inputYear" class="select">
                                          <?
									   $currentYear =date(Y);
									   for($i=$currentYear-8;$i>=$currentYear-70;$i--) { ?>
                                          <option value="<?=$i?>">
                                          <?=$i+543?>
                                          </option>
                                          <? } ?>
                                        </select>
                                        <? if($inputDate>0){?>
                                        <script language="javascript">
									  document.myForm.inputDate.value='<?=$inputDate?>';
									  document.myForm.inputMonth.value='<?=$inputMonth?>';
									  document.myForm.inputYear.value='<?=$inputYear?>';
									  </script>
                                        <? }?>
                                    </td>
                                  </tr>
                                  <!-----------------------tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลการทำงาน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><select name="inputOccupationID" class="select" id="inputOccupationD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_Occupation." WHERE ".$System_TableName_Occupation."_Status='Enable' ORDER BY ".$System_TableName_Occupation."_ID";
										  $Query_Occupation = mysql_query($sql);
										  ?>
                                        <? while ($Row_Occupation = mysql_fetch_array($Query_Occupation)) { ?>
                                        <option value="<?=$Row_Occupation[$System_TableName_Occupation."_ID"]?>">
                                        <?=$Row_Occupation[$System_TableName_Occupation."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputOccupationID>0){?>
                                        <script language="javascript">
	document.myForm.inputOccupationID.value='<?=$inputOccupationID?>';
	                                    </script>
                                        <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputOccupation" type="text" class="input_left" id="inputOccupation" value="<?=$inputOccupation?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><select name="inputBusinessTypeID" class="select" id="inputBusinessTypenD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_Status='Enable' ORDER BY ".$System_TableName_BusinessType."_ID";
										  $Query_BusinessType = mysql_query($sql);
										  ?>
                                        <? while ($Row_BusinessType = mysql_fetch_array($Query_BusinessType)) { ?>
                                        <option value="<?=$Row_BusinessType[$System_TableName_BusinessType."_ID"]?>">
                                        <?=$Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputBusinessTypeID>0){?>
                                        <script language="javascript">
	document.myForm.inputBusinessTypeID.value='<?=$inputBusinessTypeID?>';
	                                    </script>
                                        <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputBusinessType" type="text" class="input_left" id="inputBusinessType" value="<?=$inputBusinessType?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ตำแหน่ง&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputPosition" type="text" class="input_left" id="inputPosition" value="<?=$inputPosition?>" size="40" maxlength="100"></td>
                                  </tr------------------->
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลที่อยู่ปัจจุบัน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">เบอร์โทรศัพท์&nbsp;&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputPhone" type="text" class="input_left" id="inputPhone" value="<?=$inputPhone?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputAddress" type="text" class="input_left" id="inputAddress" value="<?=$inputAddress?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <!----------------tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputAddress2" type="text" class="input_left" id="inputAddress2" value="<?=$inputAddress2?>" size="40" maxlength="100"></td>
                                  </tr------------------->
                                  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;</td>
                                    <td class="table_col2">
                                      <select name="inputCityID" class="input_select">
                                        <?
					$sql = "SELECT ".$System_TableName_Province."_ID,".$System_TableName_Province."_Nameth FROM ".$System_TableName_Province;
					$Query_City = mysql_query($sql);
					?>
                                        <? while ($Row_City = mysql_fetch_array($Query_City)) { ?>
                                        <option value="<?=$Row_City[$System_TableName_Province."_ID"]?>">
                                        <?=$Row_City[$System_TableName_Province."_Nameth"]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                      <? if ($Row[$myModule_Member."_CityID"]>0) echo "<script language='JavaScript'> document.myForm.inputCityID.value = '".$Row[$myModule_Member."_CityID"]."'; </script>"; ?>
</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ &nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputPostalCode" type="text" class="input_left" id="inputPostalCode" value="<?=$inputPostalCode?>" size="40" maxlength="20"></td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr> 
                              <td><table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                                  <tr align="right"> 
                                    <td height="30" colspan="4" align="center" class="table_footer"> 
                                      <table width="300" border="0" cellspacing="0" cellpadding="2">
                                        <tr align="center"> 
                                          <td> 
<script language="JavaScript" src="../../webengine/lib/checkemail.js"></script> 
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { return !isNaN(myObj.value*1) }
function isEqual(myObj1,myObj2) {	if(myObj1.value==myObj2.value) { return true; }	return false;}
function verifySubmit() {
	with(document.myForm) {
		if(!isBlank(inputPass)) {
			if(inputPass.value.length<4){ alert("กรุณากรอก รหัสผ่าน อย่างน้อย 4 ตัวอักษร");  inputPass.focus(); return false; }
			if(!isEqual(inputPass,inputConfirm)) { alert("รหัสผ่าน กับ ยืนยันรหัสผ่าน ของท่านไม่ตรงกันกรุณากรอกใหม่!"); inputPass.focus(); return false; }
		}
		//if(isBlank(inputQuestion)) {	alert("กรุณากรอก คำถามกันลืม");  inputQuestion.focus(); return false; }
		//if(isBlank(inputAnswer)) {	alert("กรุณากรอก คำตอบกันลืม");  inputAnswer.focus(); return false; }
		//if(isBlank(inputAlias)) {	alert("กรุณากรอก นามแฝง");  inputAlias.focus(); return false; }

		if(isBlank(inputFName)) {alert("กรุณากรอกชื่อ");  inputFName.focus(); return false; }
		if(isBlank(inputLName)) {alert("กรุณากรอกนามสกุล");  inputLName.focus(); return false; }
	}
	 document.myForm.submit();
}
</script>
										 <input name="btAdd2" type="button" class="button_80" id="btAdd2" value="Save" onClick="verifySubmit();"> </td>
                                          <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="document.myReturnForm.submit();" value="Cencel"> </td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table>
                  <br>
                  <br>
                  <? 
#########################################################
} else if($action=="update") { 

	 $MaxID = $CheckBoxID1;
	 $inputBirthDate=$inputYear."-".$inputMonth."-".$inputDate;
	$inputPass=encodeStr($inputPass);
	$sql = "UPDATE ".$myModule_Table." SET ";
	if ($inputPass<>"") $sql .= $myModule_Table."_Pass='$inputPass',";
	$sql .= 	
	$myModule_Table."_FName='$inputFName',".
	$myModule_Table."_LName='$inputLName',".
	$myModule_Table."_BirthDate='$inputBirthDate',".
	$myModule_Table."_Gender='$inputGender',".
	$myModule_Table."_HomeTown='$inputAddress',".
	$myModule_Table."_CityID='$inputCityID',".
	$myModule_Table."_PostalCode='$inputPostalCode',".
	$myModule_Table."_Phone='$inputPhone',".
	$myModule_Table."_LastUpdate=Now()".
	" WHERE ".$myModule_Table."_ID=".$MaxID;

	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	if(is_file($inputFullPhoto) || is_file($inputThumbnailPhoto)) {
		$sql = "SELECT ".$myModule_Table."_FullPhoto,".$myModule_Table."_ThumbnailPhoto FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$MaxID;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		$Row = mysql_fetch_array($Query);
	
		srand(make_seed());
		$myrand = rand(1111,9999);
	
		// Check to create module data directory. ---------
		if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
		if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,0777); }
		// ------------------------------------------------
		
		if(is_file($inputFullPhoto)) {
			$ImageData = getimagesize($inputFullPhoto);
			if($ImageData!=NULL) {
				// Delete Old Photo
				if ($Row[$myModule_Table."_FullPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"])) {
					unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"]);
				}
				
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-full-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputFullPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_FullPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
		if(is_file($inputThumbnailPhoto)) {
			$ImageData = getimagesize($inputThumbnailPhoto);
			if($ImageData!=NULL) {
				// Delete Old Photo
				if ($Row[$myModule_Table."_ThumbnailPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"])) {
					unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"]);
				}
				
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-thumb-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputThumbnailPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_ThumbnailPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
	}
	?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                  <? 
#########################################################
} else if($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			
			$sql = "DELETE FROM ".$myModule_Table." WHERE ". $myModule_Table."_ID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			
			//$sql = "DELETE FROM ".$myModule_FriendList." WHERE ". $myModule_FriendList."_FriendMemberID=".$$myVar;
			//$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			
			$sql = "DELETE FROM ".$myModule_Blog_Comment." WHERE ". $myModule_Blog_Comment."_CreateByID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}

	}
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<? 
#########################################################
} else if($action=="setstatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ". $myModule_Table."_Status='$SelectStatus' WHERE ". $myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?
} else if($action=="setactivatestatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ". $myModule_Table."_Activate='$SelectStatus' WHERE ". $myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?
} else if($action=="setmembertypestatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<? 
#########################################################
} else if($action=="setrecommendstatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ". $myModule_Table."_RecommendStatus='$SelectStatus' WHERE ". $myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
					<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
					<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>

<?
} else if($action=="export_data") { 
		
		//$export_string = gen_exportstring($System_DataBase_Name,$myModule_Table," ORDER BY ".$myModule_Table."_ID ASC LIMIT 0,2000");
		
		$max_record = 2000;
		$sql = "SELECT Count(*) FROM ".$myModule_Table;
		$Query = mysql_query($sql);
		$Row = mysql_fetch_row($Query);
		$file_count = ceil($Row[0]/$max_record);
		
		for ($i=1;$i<=$file_count;$i++) {
			$export_string[$i] = gen_exportstring($System_DataBase_Name,$myModule_Table," ORDER BY ".$myModule_Table."_ID ASC LIMIT ".($max_record*($i-1)).",".$max_record);
		}
		
		
		//$export_string = str_replace("/n","",$export_string);
		//$export_string = str_replace("/r","",$export_string);
		//$export_string = nl2br($export_string);
		//$export_string = addslashes($export_string);
		//$export_string = str_replace("<br>","",$export_string);
		/*
		$export_string = nl2br($export_string);
		$export_string = str_replace("<br>","",$export_string);
		*/
		//$export_string = str_replace("<br>","<newline>",$export_string);
?>
				  <table width="50%" border="0" cellpadding="0" cellspacing="0">
					  <? for ($i=1;$i<=count($export_string);$i++) { ?>
					  <form action="../system/exportdata.php" method="post" name="myExportForm<?=$i?>" id="myExportForm<?=$i?>">
						<input name="export_string" type="hidden" id="export_string" value='<?=$export_string[$i]?>'>
					  </form>
					  <? } ?>
					  <form action="?" method="post" name="myForm" id="myForm">
						<input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
						<input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
						<input name="action" type="hidden" id="action">
						<input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
						<input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
						<input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
						<input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
						<input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
						<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
						<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
                      <tr> 
                        <td  bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">Export 
                                <?=getMenuName($SystemMenuID)?> Data
                              </td>
                            </tr>
                          </table>
						<table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_col3">
                                  <tr>
                                    <td width="100%" height="70" align="center" class="table_col3">finished export data<br>
                                      please click &quot;Export&quot; button<br>
                                      for download data </td>
                                  </tr>
                                </table></td>
                              </tr>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <tr align="right"> 
                              <td height="30" colspan="4" align="center" class="table_footer"> 
                                <table width="300" border="0" cellspacing="0" cellpadding="2">
                                  <tr align="center"> 
                                  <td>
								  <? for ($i=1;$i<=count($export_string);$i++) { ?>
								  <input name="btExport" type="button" class="button_80" id="btExport" onClick="document.myExportForm<?=$i?>.submit()" value="Export <?=$i?>">
								  <? } ?>
&nbsp;&nbsp;<input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="document.myForm.submit()" value="Back"> </td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
              </table>
                  <br>
              <?
} else {
?>
<?
# Check to set default value #########################
if($PageSize=="") { $PageSize = $SystemModule_defaultPageSize; }
if($PageShow=="") { $PageShow = $SystemModule_defaultPageShow; }
if($ASCDESC=="") { $ASCDESC = $SystemModule_ASCDESC; } 
if($OrderBy=="") { $OrderBy = $SystemModule_OrderBy; } 
if($action=="switchorder") { 

	if($ASCDESC=="ASC") { $ASCDESC = "DESC"; }  else { $ASCDESC="ASC"; } 
} 
if($PageSearch!="") { $PageSearch=trim($PageSearch); }
# Count total record size #########################
$sql = "SELECT * FROM ".$myModule_Table;
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\n");

$sql = "SELECT * FROM ".$myModule_Table." WHERE ". $myModule_Table."_ModuleKey='$SystemModuleKey'  ";

if ($MemberType<>"") {
	$sql .= " AND ".$myModule_Table."_MemberType='".$MemberType."'";
}
if ($SpecialType=="YoungClub") {
	$sql .= " AND ".$myModule_Table."_YoungClubSerialNo <>''";
}
if ($SpecialType=="Normal") {
	$sql .= " AND ".$myModule_Table."_YoungClubSerialNo =''";
}
if($inputAge!="" && $inputAge!="0"){
	$sql.=" AND ".(date("Y")+543)."-substring(".$myModule_Table."_BirthDate,7,4) BETWEEN ".str_replace("-"," AND ",$inputAge);
}
if($inputMonth!="" && $inputMonth!="0"){
	$sql.=" AND substring(".$myModule_Table."_BirthDate,4,2)='".$inputMonth."'";
}
if($inputGender!="" && $inputGender!="0"){
	$sql.=" AND ".$myModule_Table."_Gender='".$inputGender."'";
}
if($inputInterrest!="" && $inputInterrest!="0"){
	$sql.=" AND substring(".$myModule_Table."_Interrest,".$inputInterrest.",1)='1'";
}
if($inputSalary!="" && $inputSalary!="0"){
	$sql.=" AND ".$myModule_Table."_Salary='".$inputSalary."'";
}
if($inputDegree!="" && $inputDegree!="0"){
	$sql.=" AND ".$myModule_Table."_Education='".$inputDegree."'";
}
/*
if($PageSearch!="") {
	$sql.=" AND ( ".$myModule_Table."_FName LIKE '%$PageSearch%' ".
	" OR ". $myModule_Table."_LName LIKE '%$PageSearch%' ".
	" OR ". $myModule_Table."_User LIKE '%$PageSearch%' ".
	" OR ". $myModule_Table."_Email LIKE '%$PageSearch%' ".
	") ";
}
*/
if($PageSearch!="") {
	$sql .= " AND ".$myModule_Table."_".$PageSearchInField." LIKE '%".$PageSearch."%'";

}

$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$TotalRecordCount=MYSQL_NUMROWS($Query);
# Find max page size #########################
if($TotalRecordCount>$PageSize) {
	$NoOfPage= ceil($TotalRecordCount/$PageSize);
} else {
	$NoOfPage=1;
}
# Recover page show into range #########################
if($PageShow>$NoOfPage) { $PageShow=$NoOfPage; }
# Select only paging range #########################

$RecordStart = ($PageShow-1)*$PageSize;

$sql.=" ORDER BY $OrderBy $ASCDESC ";
$sql.=" LIMIT $RecordStart , $PageSize";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
                  <script language="JavaScript" type="text/JavaScript">
function Paging_CheckAll(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			document.getElementById(txtCheckBoxFirstName+i).checked = objCheckHeader.checked;			
	return true;
}
function Paging_CheckAllHandle(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	var isCheckedAll = true;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(!document.getElementById(txtCheckBoxFirstName+i).checked) 
				isCheckedAll = false;
	objCheckHeader.checked = isCheckedAll;
	return true;
}
function Paging_CountChecked(txtCheckBoxFirstName,intTotalItems) {
	var intChecked = 0;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(document.getElementById(txtCheckBoxFirstName+i).checked) 
				intChecked ++;
	return intChecked ;
}
function Paging_CheckedThisItem(objCheckHeader,indexing,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(i==indexing) {
				document.getElementById(txtCheckBoxFirstName+i).checked = true;
			} else {
				document.getElementById(txtCheckBoxFirstName+i).checked = false;
			}
	objCheckHeader.checked = false;
	return true;
}
</script>
                  <div id="divMemberType" style="display:none; position:absolute; top:-115px; left:180px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myMemberTypeForm" id="myMemberTypeForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                              <tr> 
                                <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                <td align="center">Select Status</td>
                                <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divMemberType').style.display='none'; "></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="120" align="center" class="table_row1"><br> 
                            <table width="120" border="0" cellpadding="2" cellspacing="0">
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="normal" checked></td>
                                <td height="22" class="text_bold">ลูกค้าทั่วไป</td>
                              </tr>
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="adsl"></td>
                                <td height="22" class="text_bold">ลูกค้า TOT</td>
                              </tr>
                            </table>
                            <br> <table border="0" cellspacing="0" cellpadding="6">
                              <tr> 
                                <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myMemberTypeForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myMemberTypeForm.toolbarStatus[0].value;
}
if(document.myMemberTypeForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myMemberTypeForm.toolbarStatus[1].value;
}
document.myForm.action.value='setmembertypestatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divMemberType').style.display='none';"></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                        </tr>
                      </form>
                    </table>
                  </div>
                  <div id="divActivate" style="display:none; position:absolute; top:-115px; left:180px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myActivateForm" id="myActivateForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                              <tr> 
                                <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                <td align="center">Select Status</td>
                                <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divActivate').style.display='none'; "></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="120" align="center" class="table_row1"><br> 
                            <table width="120" border="0" cellpadding="2" cellspacing="0">
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="0" checked></td>
                                <td height="22" class="text_bold">Not</td>
                              </tr>
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="1"></td>
                                <td height="22" class="text_bold">Activate</td>
                              </tr>
                            </table>
                            <br> <table border="0" cellspacing="0" cellpadding="6">
                              <tr> 
                                <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myActivateForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myActivateForm.toolbarStatus[0].value;
}
if(document.myActivateForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myActivateForm.toolbarStatus[1].value;
}
document.myForm.action.value='setactivatestatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divActivate').style.display='none';"></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                        </tr>
                      </form>
                    </table>
                  </div>
                  <div id="divDataPicker" style="display:none; position:absolute; top:-115px; left:180px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myStatusForm" id="myStatusForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                              <tr> 
                                <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                <td align="center">Select Status</td>
                                <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker').style.display='none'; "></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="120" align="center" class="table_row1"><br> 
                            <table width="120" border="0" cellpadding="2" cellspacing="0">
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Enable" checked></td>
                                <td height="22" class="text_bold">Enable</td>
                              </tr>
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Disable"></td>
                                <td height="22" class="text_bold">Disable</td>
                              </tr>
                            </table>
                            <br> <table border="0" cellspacing="0" cellpadding="6">
                              <tr> 
                                <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myStatusForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[0].value;
}
if(document.myStatusForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[1].value;
}
document.myForm.action.value='setstatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divDataPicker').style.display='none';"></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                        </tr>
                      </form>
                    </table>
                  </div>
				    <div id="divRecommend" style="display:none; position:absolute; top:-115px; left:180px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                      <form action="?" method="post" name="myRecommendForm" id="myRecommendForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                              <tr> 
                                <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                                <td align="center">Select Status</td>
                                <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker').style.display='none'; "></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="120" align="center" class="table_row1"><br> 
                            <table width="120" border="0" cellpadding="2" cellspacing="0">
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Yes" ></td>
                                <td height="22" class="text_bold">Yes</td>
                              </tr>
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="No" checked></td>
                                <td height="22" class="text_bold">No</td>
                              </tr>
                            </table>
                            <br> <table border="0" cellspacing="0" cellpadding="6">
                              <tr> 
                                <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myRecommendForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myRecommendForm.toolbarStatus[0].value;
}
if(document.myRecommendForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myRecommendForm.toolbarStatus[1].value;
}
document.myForm.action.value='setrecommendstatus';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.submit();
"></td>
                                <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divRecommend').style.display='none';"></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                        </tr>
                      </form>
                    </table>
                  </div>
                  <script language="JavaScript" type="text/JavaScript">
var StatusIndex=0;
function ShowDataPicker(myDivName,RefX,RefY) {
	document.getElementById(myDivName).style.display=''; 
	document.getElementById(myDivName).style.left = document.body.scrollLeft + window.event.clientX + RefX;
	document.getElementById(myDivName).style.top= document.body.scrollTop+ window.event.clientY + RefY;
}
	  </script>
                  <br>
                  <table width="88%" height="22" border="0" cellpadding="2" cellspacing="0">
                    <form action="?" method="post" name="myHeaderButton" id="myHeaderButton" onSubmit="return false;">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <tr valign="bottom"> 
                        <td width="25%"> <table border="0" cellspacing="0" cellpadding="2">
                          <tr> 
<td><input name="btView" type="button" class="button_60" id="btView" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='view';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to view this record.');
}
				  " value="View"></td>
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
 							<td><input name="btEdit" type="button" class="button_60" id="btEdit" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==0) alert('Please select 1 record');
	else alert('Please select only 1 record');
}
				  " value="Edit"></td>
                              <td><input name="btDelete" type="button" class="button_60" id="btDelete" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)>0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete"></td>
<? }?>
</tr>
                        </table></td>
                        <td width="75%" valign="middle" >
						<strong><font color="#990000"></font></strong></td>
                      </tr>
                    </form>
              </table>
                  <table width="90%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_toolbar">
                    <form action="?" method="post" name="myToolbarForm" id="myToolbarForm" onSubmit="return false;">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <tr> 
                        <td width="5" align="left" valign="top"> <img src="../images/bgborder1w.gif" width="5" height="5"></td>
                        <td valign="bottom"> <table border="0" cellpadding="2" cellspacing="0" class="toolbar">
                            <tr> 
                              <td width="10">&nbsp;</td>
                              <td>Page</td>
                              <td> 
                                <? 
				  if($NoOfPage>1) { 
				  ?>
                                <select name="toolbarPageShow" class="select" onChange="document.myForm.PageShow.value=this.value; document.myForm.submit(); ">
                                  <? 
if($NoOfPage<$SystemModule_MaxPage) {
	// Show page list #########################
	for($i=1;$i<=$NoOfPage;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}  else {
	// # If total page count greater than default max page  value then reduce page select size #########################
	$starti = $PageShow-$SystemModule_ReduceRange;
	if($starti<1) { $starti=1; }
	$endi = $PageShow+$SystemModule_ReduceRange;
	if($endi>$NoOfPage) { $endi=$NoOfPage; }
	//#####################
	for($i=$starti ;$i<=$endi;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}
?>
                                </select> 
                                <? 
 } else { 
	echo "1";
 }
 ?>
                              </td>
                              <td>of 
                                <?=$NoOfPage?>
                              </td>
                              <td width="10">&nbsp;</td>
                              <td>Page size</td>
                              <td> <input name="toolbarPageSize" type="text" class="input_center" id="toolbarPageSize" value="<?=$PageSize?>" size="3" maxlength="3"></td>
                              <td> <input name="btChangePageSize" type="button" class="button_normal" id="btChangePageSize" value=" Go " onClick="
if(isNaN(document.myToolbarForm.toolbarPageSize.value*1)) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
if(document.myToolbarForm.toolbarPageSize.value<=0) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
document.myForm.PageSize.value=document.myToolbarForm.toolbarPageSize.value; 

document.myForm.submit(); 
				  "> </td>
                            </tr>
                          </table></td>
                        <td align="right" valign="bottom"> <table border="0" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td>Found 
                                <?=$TotalRecordCount?>
                                record</td>
                              <td width="10">&nbsp;</td>
                              <? if($PageShow>1) { ?>
                              <td width="21" align="center"> <img src="../images/controlpage/playset_start.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_start_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_start.gif';" 
				  onClick="document.myForm.PageShow.value=1; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="21" align="center"><img src="../images/controlpage/playset_start_disable.gif" width="21" height="21"></td>
                              <? } ?>
                              <? if($PageShow>1) { ?>
                              <td width="21" align="center"> <img src="../images/controlpage/playset_backward.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_backward_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_backward.gif';" 
				  onClick="document.myForm.PageShow.value--; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="21" align="center"><img src="../images/controlpage/playset_backward_disable.gif" width="21" height="21"></td>
                              <? } ?>
                              <td width="21" align="center"> <img src="../images/controlpage/playset_stop.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_stop_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_stop.gif';" 
				  onClick="
					with(document.myForm) {
						PageShow.value='';
						PageSize.value='';
						ASCDESC.value='';
						OrderBy.value='';
						PageSearch.value='';
						submit();
					}
					"></td>
                              <? if($PageShow<$NoOfPage) { ?>
                              <td width="21" align="center"> <img src="../images/controlpage/playset_forward.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_forward_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_forward.gif';" 
				  onClick="document.myForm.PageShow.value++; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_forward_disable.gif" width="21" height="21"></td>
                              <? } ?>
                              <? if($PageShow<$NoOfPage) { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_end.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_end_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_end.gif';" 
				  onClick="document.myForm.PageShow.value='<?=$NoOfPage?>'; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_end_disable.gif" width="21" height="21"></td>
                              <? } ?>
                            </tr>
                          </table></td>
                        <td width="5" align="right" valign="top"><img src="../images/bgborder2w.gif" width="5" height="5"></td>
                      </tr>
                    </form>
                  </table>
                  <table width="90%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                    <tr> 
                      <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                          <form action="?" method="post" name="myForm" id="myForm">
                            <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                            <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                            <input name="action" type="hidden" id="action">
                            <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                            <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                            <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                            <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                            <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
							<input name="PageSearchInField" type="hidden" id="PageSearchInField" value="<?=$PageSearchInField?>">
							<input name="inputAge" type="hidden" id="inputAge" value="<?=$inputAge?>">
							<input name="inputMonth" type="hidden" id="inputMonth" value="<?=$inputMonth?>">
							<input name="inputGender" type="hidden" id="inputGender" value="<?=$inputGender?>">
							<input name="inputInterrest" type="hidden" id="inputInterrest" value="<?=$inputInterrest?>">
							<input name="inputSalary" type="hidden" id="inputSalary" value="<?=$inputSalary?>">
							<input name="inputDegree" type="hidden" id="inputDegree" value="<?=$inputDegree?>">
                            <input name="SelectStatus" type="hidden" id="SelectStatus">
							<input name="MemberType" type="hidden" id="MemberType" value="<?=$MemberType?>">
							<input name="SpecialType" type="hidden" id="SpecialType" value="<?=$SpecialType?>">
                            <tr align="center" class="menu_table_header"> 
                              <td width="20" height="24"><input name="CheckBoxAll" type="checkbox" class="form_checkbox" id="CheckBoxAll" value="Yes" onClick="Paging_CheckAll(this,'CheckBoxID',document.myForm.TotalCheckBoxID.value)"></td>
                              <td width="20" height="24" align="center">No.</td>
                              <td width="88" align="center">Photo</td>
                              <!---td width="30" height="24" align="center" style="display:none "> 
                              <? 
$myOrderBy = $myModule_Table."_ID";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">ID</a></td------>
                              <td width="219" height="24"> 
                                <? 
$myOrderBy = $myModule_Table."_FName";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                <? }
	if($ASCDESC=="ASC") { ?>
                                <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                <? }
} 
?>
                                <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					"> Name</a></td>
                              <td width="75"><? 
$myOrderBy = $myModule_Table."_DisplayName";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                <? }
	if($ASCDESC=="ASC") { ?>
                                <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                <? }
} 
?>
                                <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">DisplayName</a> </td>
                              <td width="80" height="24"><? 
$myOrderBy = $myModule_Table."_CreateDate";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                <? }
	if($ASCDESC=="ASC") { ?>
                                <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                <? }
} 
?><a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}">Create Date</a></td>
					          <td width="80">Last Login  </td>
                              <td width="74" height="24"> 
                                <? 
$myOrderBy = $myModule_Table."_Status";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                <? }
	if($ASCDESC=="ASC") { ?>
                                <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                <? }
} 
?>
                                <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">Status</a> / Action</td>
                            </tr>
<?
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		if($myClassRow=="table_row1") { $myClassRow="table_row2"; } else { $myClassRow="table_row1";  }
		$Row=MYSQL_FETCH_ARRAY($Query);
?>							
                             <tr class="<?=$myClassRow?>" onMouseOver="this.className='table_rowover'" onMouseOut="this.className='<?=$myClassRow?>'">  
                              <td height="20" align="center"> <input name="CheckBoxID<?=$index?>" type="checkbox" class="form_checkbox" id="CheckBoxID<?=$index?>" onClick="Paging_CheckAllHandle(document.myForm.CheckBoxAll,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" value="<?=$Row[$myModule_Table."_ID"]?>"></td>
                              <td height="20" align="center"><?=$RecordStart+$index?></td>
                              <td height="20" align="center"><a href="../../profile/index.php?memberid=<?=$Row[$myModule_Member."_ID"]?>" target="_blank">
							  <img src="<? if($Row[$myModule_Member."_ThumbnailPhoto"]!=""){?><?=$myModule_FullPath_ThumbnailPicture?>/<?=$Row[$myModule_Member."_ThumbnailPhoto"]?><? } else {?>../../images/bank-ohload.gif<? }?>" width="76" height="76" hspace="5" border="1px" style="border-color:#000000 "></a></td>
                              <td height="20">(<span class="text_bold">ID</span> :<strong> <? echo sprintf("%06d",$Row[$myModule_Member."_ID"]); ?> </strong> <strong> </strong>)<a href="#" onClick="
Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.action.value='view';
document.myForm.submit();"  class="link_submenu">
<br>
<font size="3"><strong><?=member_displayname($Row[$myModule_Member."_ID"])?></strong></font> <br>
<?=$Row[$myModule_Table."_FName"]?>&nbsp;&nbsp;<?=$Row[$myModule_Table."_LName"]?>
                              </a><br>  
                              <a href="mailto:<?=$Row[$myModule_Table."_User"]?>" target="_blank">
							      <?=$Row[$myModule_Table."_User"]?>
					           </a></td>
                              <td width="75" align="center"><?=$Row[$myModule_Table."_DisplayName"]?><br></td>
                              <td height="20">
						        <a href="mailto:<?=$Row[$myModule_Table."_User"]?>" target="_blank">						        </a>
						        <?
								  echo ShowDate($Row[$myModule_Table."_CreateDate"]);
								  ?></td>
                               <td align="center"><?
							   if($Row[$myModule_Table."_LastLogin"]>0){
								  echo ShowDate($Row[$myModule_Table."_LastLogin"]);
								  }
								  else echo "<font color='#FF0000'>No Login</font>";
								  ?>
&nbsp;</td>  
                             <td width="74" height="30" align="center"><img src="../images/icon/ico442.gif" width="8" height="14">&nbsp; 
							      <font  color="#990000">
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
<span onMouseOver="this.style.cursor='hand'" onClick="
if('<?=$Row[$myModule_Table."_Status"]?>'=='Enable') {
	document.myStatusForm.toolbarStatus[0].checked=true;
}
if('<?=$Row[$myModule_Table."_Status"]?>'=='Disable') {
	document.myStatusForm.toolbarStatus[1].checked=true;
}
StatusIndex = <?=$index?>;
ShowDataPicker('divDataPicker',-230,-150)
"> 
<? }?>
                                  <?=$Row[$myModule_Table."_Status"]?>
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                  </span>
<? }?>
</font>
<br>
<table border="0" cellspacing="0" cellpadding="1">
                                    <tr align="center" valign="bottom"> 
<td><img src="../images/icon/ico416.gif" alt="View" width="16" height="21" border="0" onMouseOver="this.style.cursor='hand'" onClick="
Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.action.value='view';
document.myForm.submit();
						"></td>
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
<td><img src="../images/icon/ico425.gif" alt="Edit" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="

	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();

						"></td>
						<? }?>
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                      <td><img src="../images/icon/ico417.gif" alt="Delete" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to delete this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='delete';
	document.myForm.submit();
} "></td>
<? }?>
</tr>
                               </table></td>
                            </tr>
	<?
		$index++;
	}
} else {  ?>
                        <tr class="table_row1"> 
                          <td height="80" colspan="11" align="center">Data not 
                            found!</td>
                        </tr>
 <? } ?>						
                            <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>">
                          </form>
                        </table>
                        <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                          <form action="?" method="post" name="mySearchForm" id="mySearchForm" onSubmit="return false;">
                            <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                            <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                            <tr align="right"> 
                              <td colspan="4" align="right" class="table_footer">                              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="80%"><table width="100%" height="22"  border="0" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td width="87%" height="22" align="right"><strong>Keyword : </strong><input name="toolbarPageSearch" type="text" class="input_left" id="toolbarPageSearch" value="<?=$PageSearch?>" size="20" maxlength="50">&nbsp;&nbsp;<strong>In Field :
                                          <select name="toolbarPageSearchInField" class="select">
										  	<option value="ID">ID</option>
											<option value="DisplayName ">DisplayName</option>
											<option value="FName">First Name</option>
											<option value="LName">Last Name</option>
											<option value="User">Email</option>
											<option value="User">UserName</option>
                                          </select> <?
										  if ($PageSearchInField<>"") echo "<script language='JavaScript'> document.mySearchForm.toolbarPageSearchInField.value = '".$PageSearchInField."'; </script>";
										  ?>
                                        </strong></td>
                                        <td width="13%" height="22" align="right"><input name="btPageSearch" type="button" class="button_60" id="btPageSearch2" value="Search" onClick="
/*
document.myForm.inputAge.value=document.mySearchForm.inputAge.value;
document.myForm.inputMonth.value=document.mySearchForm.inputMonth.value;
document.myForm.inputGender.value=document.mySearchForm.inputGender.value;
document.myForm.inputInterrest.value=document.mySearchForm.inputInterrest.value;
document.myForm.inputSalary.value=document.mySearchForm.inputSalary.value;
document.myForm.inputDegree.value=document.mySearchForm.inputDegree.value;
*/
document.myForm.PageSearch.value=document.mySearchForm.toolbarPageSearch.value;
document.myForm.PageSearchInField.value=document.mySearchForm.toolbarPageSearchInField.value;
document.myForm.submit();
						"></td>
                                      </tr>
                                  </table></td>
                                </tr>
                              </table></td>
                            </tr>
                          </form>
                        </table></td>
                    </tr>
                  </table>
                  <table width="88%" height="22" border="0" cellpadding="2" cellspacing="0">
                    <form action="?" method="post" name="myFooterButton" id="myFooterButton" onSubmit="return false;">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <tr> 
                        <td width="61%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
                            <tr> 
                              <td><input name="btView" type="button" class="button_60" id="btView" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='view';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to view this record.');
}
				  " value="View"></td>
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                               <td><input name="btEdit" type="button" class="button_60" id="btEdit" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==0) alert('Please select 1 record');
	else alert('Please select only 1 record');
}
				  " value="Edit"></td>
                               <td><input name="btDelete" type="button" class="button_60" id="btDelete" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)>0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete"></td>
<? }?>
                          </tr>
                          </table></td>
                        <td width="39%" align="right" valign="top"><? if($System_Session_Permission[$SystemMenuID]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?><input name="btnExport" type="button" class="button_normal" id="btnExport" value="Export Data" onClick="
						document.myForm.action.value = 'export_data';
						document.myForm.submit();
						">
						<? } ?>&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="61%" valign="top">&nbsp;</td>
                        <td align="right" valign="top">&nbsp;</td>
                      </tr>
                    </form>
                  </table>
                  <br>
                  <? 
}
#########################################################
?>
                   
<title>Web Engine : 
<?=$System_Variable_Title?>
</title>

	  <!-- InstanceEndEditable --> 
            <? }  else { echo "&nbsp;&nbsp;&nbsp;"; } ?>		</td>
        <td width="17" valign="top" background="../images/object/border_07.gif"><img src="../images/object/border_17.gif" width="17" height="119"></td>
      </tr>
      <tr>
        <td height="16"><img src="../images/object/border_09.gif" width="20" height="16"></td>
        <td height="16" background="../images/object/border_11.gif"><img src="../images/object/border_11.gif" width="1" height="16"></td>
        <td><img src="../images/object/border_13.gif" width="17" height="16"></td>
      </tr>
    </table></td>
        </tr>
      </table></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td> 
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="4" height="30" align="left" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td height="30" align="center" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td width="4" height="30" align="right" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
  </tr>
</table>
<table width="95%" height="22" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="left"><font color="#666666">Copyrights <img src="../../images/web/copyright.gif" width="8" height="9"> 
      2008  MOE. All rights are reserved.</font></td>
    <td align="right"><font color="#666666">Powered by <strong><a href="http://www.net-com.co.th">Net-Com</a></strong></font></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
<? 
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox