/home/mip/public_html_/old-website/func_proc.php
<?php
require_once("func_select.php");
require_once("func_select_codes.php");
require_once("func_data_validation.php");

function do_header($title){ 
global $site_title;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$site_title?> - <?=$title?></title>
<!-- lightbox  start -->
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
<script src="js/func_js.js" type="text/javascript"></script>
<? require_once("js/func_js.php"); ?>
<!-- lightbox  end -->
<script src="ajax.js" type="text/javascript"></script> 
<script src="func_ajax.js" type="text/javascript"></script>
<SCRIPT language=javascript src="js/autotab.js"></SCRIPT>
<!-- old captcha <script language="JavaScript" type="text/javascript" src="ajax_captcha.js"></script> 
<link href="css/ota.css" rel="stylesheet" type="text/css">-->
</head>
<style type="text/css">
<!--
body,td,th { font-size: 12px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF; }

body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; font-size: 12px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF; }


.style1 {	font-size: 12px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
	padding:15px;
}
.style2 {
	font-size: 10px;
	font-family: tahoma;
	color: #FFFFFF;
}
.style3 {
	font-size: 11px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
.style3 a:link {
	color: #FFFFFF;
	text-decoration: none;
}
.style3 a:visited {
	text-decoration: none;
	color: #CCCCCC;
}
.style3 a:hover {
	text-decoration: underline;
	color: #FFFFFF;
}
.style3 .style8 a:active {
	text-decoration: none;
	color: #FFFFFF;
}
.style4 {	font-size: 12px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
	}
.style8 a:link {
	font-family: Arial, Helvetica, sans-serif;
	text-decoration: none;
	font-size: 12px;
	color: #CCCCCC;
}
.style8 {
	font-family: "Myriad Pro";
	font-size: 12px;
	color: #CCCCCC;
}
.style8 a:active {
	text-decoration: none;
	color: #FFFFFF;
}
.style8 a:visited {
	text-decoration: none;
	color: #CCCCCC;
}
.right {
color: #990000;
}
.left {
color: #000000;
font-size:12px;
}
.errorMessage { font-size: 90%; color: #333; font-family: "Lucida Grande", Helvetica, sans-serif; -khtml-box-sizing: border-box;
box-sizing: border-box; -moz-box-sizing: border-box; padding-left: 2em; padding-top: 5px; color: red; background-image: url(images/bullet_error.gif); background-repeat: no-repeat; background-position: 0 4px;display:none; }
-->
</style>
<script type="text/javascript"  src="irisonline/jquery.js"></script> 
<script type="text/javascript"> 
/*$(document).ready(function() {
	
$("ul#topnav li").hover(function() { //Hover over event on list item
	$(this).css({ 'background' : '#1376c9 url(images/topnav_active.gif) repeat-x'}); //Add background color + image on hovered list item
	$(this).find("span").show(); //Show the subnav
} , function() { //on hover out...
	$(this).css({ 'background' : 'none'}); //Ditch the background
	$(this).find("span").hide(); //Hide the subnav
});
	
});*/
</script> 
<body background="images/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border:solid; border-width:2px; border-color:#666666;">
  <!--DWLayoutTable-->
  <tr>
    <td height="178" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <!--DWLayoutTable-->
      <tr>
        <td width="195" height="178" valign="top"><img src="images/logo.jpg" width="196" height="178" /></td>
          <td width="3" valign="top" background="images/bgs.jpg" style="background-repeat:repeat-y" bgcolor="#FFFFFF"><img src="images/bgs.jpg" width="3" height="4" /></td>
          <td width="599" align="center" background="images/bg.jpg"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="542" height="175">
            <param name="movie" value="banner.swf" />
            <param name="quality" value="high" />
            <embed src="banner.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="542" height="175"></embed>
          </object></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td width="195" rowspan="3" valign="top" background="images/bgl.gif" bgcolor="#FFFFFF" style="background-repeat:repeat-x; background-position:bottom">
<?	
}
function do_menu()
{
?>
	<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg_enu.gif" style="background-repeat:no-repeat">
      <!--DWLayoutTable-->
      <tr>
        <td height="19" colspan="2" valign="top"><img src="images/spacer.gif" width="196" height="1" /></td>
      </tr>
      <tr>
        <td width="29" height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td width="170"><a href="index.php"><img src="images/home.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="company_profile.php"><img src="images/profile.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="vision.php"><img src="images/vission.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="mission.php"><img src="images/mission.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="program_services.php"><img src="images/services.png" width="136" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="support_staff&amp;facilities.php"><img src="images/support.png" width="121" height="34" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="jobs.php"><img src="images/job.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td><a href="apply_online.php"><img src="images/apply.png" width="121" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td valign="middle"><a href="request_form.php"><img src="images/fom.png" width="139" height="25" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td valign="middle"><a href="announcements_all.php"><img src="images/announcement.png" width="114" height="12" border="0" /></a></td>
      </tr>
      <tr>
        <td height="33" align="center"><img src="images/bullet.png" width="19" height="20" /></td>
        <td valign="middle"><a href="contact_us.php"><img src="images/contact.png" width="136" height="17" border="0" /></a></td>
      </tr>
      <tr>
        <td colspan="2" valign="top" align="center" style="padding-top:10px;"><form action="employer/login.php" name="formko" target="_employer" id="formko">	       
				<table width="100%" border="0" cellspacing="2" cellpadding="2">
				  <tr><td colspan="2" align="center" class="right"><b><u>EMPLOYER'S LOGIN</u></b></td></tr>
				  <tr>
					<td class="left" align="right"> USERNAME:&nbsp; &nbsp;</td>
					<td><input name="username" type="text" id="username" size="12" class="left" /></td>
				  </tr>
				  <tr>
					<td align="right" class="left">PASSWORD: &nbsp; &nbsp; </td>
					<td><input name="password" type="password" id="password" size="12" class="left" /><input type="hidden" name="submit" value="1" /></td>
				  </tr>
				  <tr>
					<td>&nbsp;</td>
					<td><input type="submit" name="Submit" value="Employer"  class="right"/></td>
				  </tr>
				</table>
				</form></td>
        </tr>
		<tr>
        <td colspan="2" valign="top" align="center" style="padding-top:10px; padding-bottom:15px;"> <!--<form action="broker/login.php" name="formko" target="_employer" id="formko">	     	      
				<table width="100%" border="0" cellspacing="2" cellpadding="2">
				  <tr><td colspan="2" align="center" class="right"><b><u>BROKER'S LOGIN</u></b></td></tr>
				  <tr>
					<td class="left" align="right"> USERNAME:&nbsp; &nbsp;</td>
					<td><input name="username" type="text" id="username" size="12" class="left" /></td>
				  </tr>
				  <tr>
					<td align="right" class="left">PASSWORD: &nbsp; &nbsp; </td>
					<td><input name="password" type="password" id="password" size="12" class="left" /><input type="hidden" name="submit" value="1" /></td>
				  </tr>
				  <tr>
					<td>&nbsp;</td>
					<td><input type="submit" name="Submit" value="Broker"  class="right"/></td>
				  </tr>
				</table>
				</form>--></td>
        </tr>
    </table></td>
    <td width="3" rowspan="3" valign="top" background="images/bgs.jpg" style="background-repeat:repeat-y"><img src="images/bgs.jpg" width="3" height="4" /></td>
    <td width="598" valign="top" background="images/bg.jpg"></td>
  </tr>
  <tr>
    <td height="418" valign="top" background="images/bg.jpg">	
		
<? } function do_rightContent(){

$sqltoday = date ("Y-m-d");
$ann = getdata("select * from web_announcements where 1 and ('$sqltoday' >=  posting_date AND '$sqltoday' < expiry_date) and status = 'Published' order by posting_date desc limit 0,4");
$num_ann = count($ann);

$jobs = getdata("select * from web_jobs where 1 and ('$sqltoday' >=  posting_date AND '$sqltoday' < expiry_date) and status = 'Open' order by posting_date desc limit 0,8");

$num_jobs = count($jobs);

?>
<table width="595" height="218" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
 <tr>
   <td height="19" colspan="3" align="center" valign="top"><img src="images/separator1.jpg" width="481" height="24" /></td>
   </tr>
  <tr>
    <td width="296" height="218" scope="col" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="316" height="23" align="center" valign="top"><img src="images/jobs.gif" width="134" height="26" /></td>
      </tr>
      <tr>
        <td height="186" valign="top" style="padding-left:10px;"><table width="257" height="71" border="0" bordercolor="whiteviolet" valign="top">
                        <ul type="circle">
                          <? for($i=1;$i<=$num_jobs;$i++){ ?>
                          <tr>
                            <td colspan="2" valign="top"  style="padding-left:10px;"><a href="page_job.php?webjob_id=<?=$jobs[$i][webjob_id]?>">
                            
                            </a>
                              <table width="243" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="26" scope="col"><img src="images/b_let.jpg" width="9" height="10" /></td>
                                  <td width="217" align="left" scope="col" class="style3"><a href="page_job.php?webjob_id=<?=$jobs[$i]['webjob_id']?>">
									<?php echo getname($jobs[$i]['position_id'],"positions","position_id"); ?>
                                  </a></td>
                                </tr>
                            </table></td>
                          </tr>
                          <? } if($num_jobs>=5){?>
                          <tr>
                            <td width="153" height="22" align="right"><img src="images/bullet.png" width="19" height="20" /></td>
                            <td width="95" align="left"><span class="style8"><a href="jobs.php" class="style8">MORE JOBS</a>&nbsp;</span></td>
                          </tr>
                          <? } ?>
                        </ul>
                      </table></td>
      </tr>
    </table></td>
    <th width="3" background="images/bgs1.jpg" scope="col"><img src="images/bgs1.jpg" width="3" height="4" /></th>
    <td width="297" scope="col"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="299" height="27" align="center" valign="top"><img src="images/announce.gif" width="199" height="22" /></td>
      </tr>
      <tr>
        <td height="186" valign="top"><table border="0" height="84">
          <ul type="circle">
            <? for($i=1;$i<=$num_ann;$i++){ ?>
            <tr>
              <td height="40" colspan="2" align="left"  style="padding-bottom:10px; padding-left:10px;" valign="top"><table width="227" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <th width="21" height="26" scope="col"><img src="images/b_let.jpg" width="9" height="10" /></th>
                    <td width="206" rowspan="2" scope="col" class="style3">
                        <a href="announcements.php?id=<?=$ann[$i]['id']?>">
                        <?=$ann[$i]['title']?>
                          <br />
                        <?=substr(strip_tags($ann[$i]['announcement']),0,75)?>
                          ... </a><a href="announcements.php?id=<?=$ann[$i]['id']?>">Read more</a> </td>
                  </tr>
                  <tr>
                    <th scope="col">&nbsp;</th>
                  </tr>
              </table></td>
            </tr>
            <? } if($num_ann>=2){?>
            <tr>
              <td width="153" height="22" align="right" bordercolor="whiteviolet"><img src="images/bullet.png" width="19" height="20" /></td>
              <td width="134" align="left" class="style8" ><a href="announcements_all.php" class="style8">READ MORE </a></td>
            </tr>
            <? } ?>
          </ul>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>

<? } 
function dateformat1($mysqldate,$style=""){				

	list($year,$month,$day) = explode("-", $mysqldate);
	
	settype($year, "integer"); 
	settype($month, "integer");
	settype($day, "integer");
	
	if(!$style) $style="M d, Y";
	
	if($year != '0000' && $month !='00' && $day !='00')	 		
	@$return_date = date("$style",mktime(0,0,0,$month,$day,$year));	 
	if($day == '00' && $month != '00')		 
	@$return_date = date("M Y",mktime(0,0,0,$month,"01",$year));		
	if($month == '00' && $year != '0000')			 
	@$return_date = "$year"; 
	if($return_date)
	return $return_date;
	else return;		
}

function do_footer() { ?>
        
</td>
  </tr>
  <tr>
    <td align="center" valign="bottom" background="images/bg.jpg">
	<img src="images/seaparator2.jpg" width="481" height="24" />
	<table width="602" height="60" border="0" cellpadding="0" cellspacing="0">
      
      <tr>
        <td align="center" scope="col"><p class="style2"><span class="style3"><a href="index.php" class="style3">HOME</a> | <a href="company_profile.php" class="style3">COMPANY PROFILE</a> | <a href="vision.php">VISION</a> | <a href="mission.php">MISSION</a>  |<a href="program_services.php"> PROGRAM &amp; SERVICES </a> |<a href="support_staff&amp;facilities.php"> STAFF &amp; FACILITIES </a>l </span><span class="style3"><a href="jobs.php">JOB OPENINGS</a><br />
        </span><span class="style3"> <a href="apply_online.php">APPLY ONLINE l </a> <a href="request_form.php">MANPOWER REQUEST FORM</a> l<a href="announcements_all.php"> ANNOUNCEMENTS</a> | <a href="contact_us.php">CONTACT  US</a></span><br />
		<!--POEA License No. 109-LB-080910-R<br />-->
  Copyright &copy; MIP International Manpower Services<br />
  Created by <a href="quantumx.html" style="color: #fff" target="_blank">Quantum X, Inc.</a><br>
            <br />
          </p>
          </td>
      </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html><? } 
function do_searchjob(){?>
	<form id="search" name="search" method="post" action="jobs.php#search">
	<div align="center"><strong>Quick Job Search:</strong>
	<input name="jname" type="text" id="jname" size="30"/>
	<input type="submit" name="search_button" id="search_button" value="Search" />
	</div>
	</form>
<?
}
function dateformat($mysqldate,$style=""){
    				
	list($year,$month,$day) = explode("-", $mysqldate);
	
	settype($year, "integer"); 
	settype($month, "integer");
	settype($day, "integer");
	
	if(!$style) $style="M d, Y";
	
	if($year != '0000' && $month !='00' && $day !='00')	 		
	$return_date = date("$style",mktime(0,0,0,$month,$day,$year));	 
	if($day == '00' && $month != '00')		 
	$return_date = date("M Y",mktime(0,0,0,$month,"01",$year));		
	if($month == '00' && $year != '0000')			 
	$return_date = "$year"; 
	if($return_date)
	return $return_date;
	else return;		
}



function get_numpercol($num_array,$cols){
	$num = ceil($num_array/$cols);		
	return $num;
}		

function addbreaks($string){
	return str_replace("\r","<br>",$string);
}

function format_to_sqldate($year="0000",$month="00",$day="00"){
	if(!$year) $year = "0000"; if(!$month) $month = "00"; if(!$day) $day = "00";
	$sqldate = "$year-$month-$day";
	return $sqldate;
}

function resize_pic($w,$h,$img,$alt="",$click=""){

 @$tmp = GetImageSize($img);
 if(!$tmp[0]) $tmp[0]=1;
 if(!$tmp[1]) $tmp[1]=1;
 
 if($tmp[0] <= $w) $w = $tmp[0];
 if($tmp[1] <= $h) $h = $tmp[1]; 
 
 $width=abs($w);
 $height=abs($h);
 
 return"$a1<img src=\"$img\" height=\"{$height}\" width=\"{$width}\" border=0 alt='$alt $c1'>$a2";
 
}

function resize_pic1($w,$h,$img,$alt="",$click="",$default="", $border=""){

	global $default_image;
	$tmp = @GetImageSize($img);// get image size
	if(!$tmp&&$default) {$tmp = @GetImageSize($default_image);$img=$default_image;}// get image size$default_image  
	elseif(!$tmp)return "";// if not an image, escape
	if($tmp[0]>=$tmp[1]){ // if width is greate than height 
	$h=$w*$tmp[1]/$tmp[0];// compute the proportional height
	}else{
	$w=$h*$tmp[0]/$tmp[1];// compute the proportional width
	}
	$width=abs($w);// there you go
	$height=abs($h);// there you go
	if($click){$a1="<a href='$img' target=_blank>";$a2="</a>";$c1=" - Click to Enlarge";}//if clickable, add anchors
	return"$a1<img src=\"$img\" height=\"{$height}\" width=\"{$width}\" border=$border alt='$alt $c1'>$a2";// return the image
 
}

/* limit the character */
function truncate_string_text($string, $max_length){
	if (strlen($string) > $max_length) {
	 $string = substr($string,0,$max_length);
	 $string .= '...';
	 /*  $string .= '..';  */ /* if you want to put .. */
	}
	return $string;
}

function mailer($host,$username,$password,$from,$body,$to=array(),$headers=array()){

    /***************************************
    ** Include the class. The header() makes
    ** the output look lovely.
    ***************************************/
    require_once('SMTP.class');
		//include('class.smtp.inc');
    
		//header('Content-Type: text/plain');

    /***************************************
    ** Setup some parameters which will be
    ** passed to the smtp::connect() call.
    ***************************************/
    $params['host'] = $host;                // The smtp server host/ip
    $params['port'] = 25;                        // The smtp server port
    $params['helo'] = exec('hostname');            // What to use when sending the helo command. Typically, your domain/hostname
    $params['auth'] = TRUE;                        // Whether to use basic authentication or not
    $params['user'] = $username; // Username for authentication
    $params['pass'] = $password;                // Password for authentication

    /***************************************
    ** These parameters get passed to the
    ** smtp->send() call.
    ***************************************/




    $send_params['recipients']    = $to;                            // The recipients (can be multiple)
    $send_params['headers']        = $headers;
    $send_params['from']        = $from;                                    // This is used as in the MAIL FROM: cmd
                                                                                        // It should end up as the Return-Path: header
    $send_params['body']        = $body;                                        // The body of the email


    /***************************************
    ** The code that creates the object and
    ** sends the email.
    ***************************************/

    if(is_object($smtp = smtp::connect($params)) AND $smtp->send($send_params)){
       return true; 
    }else{
      return false;  
    }
}		
?>