\n"; echo "\n"; echo "\n"; echo "Department of Chemical Engineering > Faculty of Engineering > University of Malaya Website\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } function checkform() { foreach ($_REQUEST as $key => $val) { $val = mysql_escape_string($val); } return(0); } function displayblock($blockpos,$islogin) { global $dbi; global $home; if($islogin==0) $qry="select image,title,name from blocks where public='1' and active='1' and position='$blockpos' order by ordering"; else { $qry="select image,title,name from blocks where active='1' and position='$blockpos' order by ordering"; } //echo $qry."
"; $resblock=sql_query($qry,$dbi); $block_num=sql_num_rows($resblock); for($block_idx=0;$block_idx<$block_num;$block_idx++){ $title=sql_result($resblock,$block_idx,"title"); $name=sql_result($resblock,$block_idx,"name"); if (($islogin==1 and $name=="block-Login") or ($home==1 and $name=="block-cssMenu")){ $content = '
\n'; } else { if ($blockpos=="center") echo "
\n"; else echo "
\n"; //Title untuk blok dan content ----------------------------------------------------------------------------------------- if ($title<>""){ if ($blockpos=="center"){ echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "
"; echo ""; echo "\n"; echo "\n"; //echo "\n"; echo "

 ".$title."
\n"; echo "
\n"; echo "
"; } else { echo "\n"; echo "\n"; echo "
".$title."
\n"; } //else } //if title if (file_exists("blocks/".$name.".php")) include("blocks/".$name.".php"); else $content="$name tidak wujud"; if ($blockpos <> "center") { //echo "\n //
\n"; //Content bagi setiap blok --------------------------------------------------------------------------------------------- echo "\n
\n"; echo $content; } if ($blockpos=="center"){ //echo "\n"; //echo "\n"; //echo "
  ".$title."
"; //echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
 
".$content."
 
\n"; echo "
"; } //echo $content; if ($blockpos <> "center"){ echo "
"; //echo "
\n"; //echo "\n"; //echo "
 
\n"; echo "
\n"; } echo "
\n"; } //islogin==1 } //for } //function function displaymodule($modulename,$filename,$frame) { global $dbi; $role=$_SESSION["userrole"]; $papar=0; $show=0; checkform(); $sql="select title,displaytitle from modules where name='$modulename'"; $res=sql_query($sql,$dbi); $numrow=sql_num_rows($res); if ($numrow > 0) list($title,$displaytitle)=sql_fetch_row($res); /*if ($frame<>0){ echo "
Home  "; if ($modulename=="News") $show=$_GET["show"]; if ($modulename=="Maklumat"){ $kategori=$_GET["kategori"]; $papar=$_GET["papar"]; $sql_title="select title from content_category where id='$kategori'"; $res_title=sql_query($sql_title,$dbi); $numrow_title=sql_num_rows($res_title); if ($numrow_title > 0) $title=sql_result($res_title,"title",0); } if ($papar) echo "$title"; elseif ($show) echo "$title"; else echo "$title"; echo "
\n"; } //$frame <> 0*/ $sql="select name from modules where name='$modulename' and active='1'"; // echo $sql; $res=sql_query($sql,$dbi); $active=sql_num_rows($res); if ($active==0) error_access_module("Inactive"); else { $sql="select name from modules where public='1' and name='$modulename'"; $res=sql_query($sql,$dbi); $grant=sql_num_rows($res); if ($grant==0){ $sql="select name from modules,module_access where modules.id=module_id and role=$role and name='$modulename'"; $res=sql_query($sql,$dbi); $grant=sql_num_rows($res); } // grant==0 if ($grant==0) error_access_module("AccessDenied"); else { if (file_exists("modules/".$modulename."/".$filename.".php")) include("modules/".$modulename."/".$filename.".php"); else error_access_module("FileNotFound"); } // grant==0 } // $active==0 } function isadmin($username) { global $dbi; $query = "SELECT role FROM user where login='$username'"; $result = sql_query($query,$dbi); $num_rows = sql_num_rows($result); if ($num_rows > 0) $role=sql_result($result,0,"role"); if ($role==1) return(1); else return(0); } function getfak($usr) { global $dbi; $query="select fakulti from user where login='$usr'"; $result = sql_query($query,$dbi); $num_rows = sql_num_rows($result); if ($num_rows > 0) $fak=sql_result($result,0,"fakulti"); else $fak=""; return($fak); } function pageredirect($url) { echo ""; } function error_access_module($err) { if ($err=="Inactive"){ $errtitle="The website is under maintenance"; $errmsg="This website has not activated. Please contact Administrator for more inquiries.

"; } else if ($err=="AccessDenied"){ $errtitle="Unauthorized access detected!"; $errmsg="Your are forbidden to access this website. Please contact your Administrator.

"; } else if ($err=="FileNotFound"){ $errtitle="File is not found"; $errmsg="The file is not found in this website."; } echo "
"; echo ""; echo "
"; echo ""; echo ""; echo "
$errtitle
$errmsg
"; } function userlogin($username) { global $dbi; $query = "SELECT username FROM user where username='$username'"; $result = sql_query($query,$dbi); $num_rows = sql_num_rows($result); if ($num_rows > 0) $islogin=1; else $islogin=0; return($islogin); } function userbanned($username) { global $dbi; $query = "SELECT username FROM forum_banned_user where username='$username'"; $result = sql_query($query,$dbi); $num_rows = sql_num_rows($result); if ($num_rows > 0) $isbanned=1; else { if ($username=="") $isbanned=1; else $isbanned=0; } return($isbanned); } function isforumadmin($username) { global $dbi; $query = "SELECT username FROM forum_admin where username='$username'"; $result = sql_query($query,$dbi); $num_rows = sql_num_rows($result); if ($num_rows > 0) $isadmin=1; return($isadmin); } ?>