Location: PHPKode > projects > CK-ERP > ck-hr/elistfilter_validate.php
<?php
//
// CK-ERP  --  Copyright (C) 2004 - 2010       Wu Chiu Kay
// ------------------------------------------------------
//  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
//
// elistfilter_validate.php 0.30.1 2010/06/30 C K Wu

	$app = 'ck-hr' ;
	$tran = 'elist' ;
	$noheader = True ;  $nonavbar = True ;
	require_once('../ck-api/ckapi.inc.php') ;

	$pass2 = isset($_GET['pass2']) ? $_GET['pass2'] : (isset($_POST['pass2'])?$_POST['pass2']:'');
	$err = isset($_GET['err']) ? $_GET['err'] : (isset($_POST['err'])?$_POST['err']:'');
	$actnum = isset($_GET['actnum']) ? $_GET['actnum'] : (isset($_POST['actnum'])?$_POST['actnum']:'');
	$phone = isset($_GET['phone']) ? $_GET['phone'] : (isset($_POST['phone'])?$_POST['phone']:'');
	$mphone = isset($_GET['mphone']) ? $_GET['mphone'] : (isset($_POST['mphone'])?$_POST['mphone']:'');
	$email = isset($_GET['email']) ? $_GET['email'] : (isset($_POST['email'])?$_POST['email']:'');
	$im = isset($_GET['im']) ? $_GET['im'] : (isset($_POST['im'])?$_POST['im']:'');
	$fax = isset($_GET['fax']) ? $_GET['fax'] : (isset($_POST['fax'])?$_POST['fax']:'');
	$url = isset($_GET['url']) ? $_GET['url'] : (isset($_POST['url'])?$_POST['url']:'');
	$address = isset($_GET['address']) ? $_GET['address'] : (isset($_POST['address'])?$_POST['address']:'');
	$prsnumber = isset($_GET['prsnumber']) ? $_GET['prsnumber'] : (isset($_POST['prsnumber'])?$_POST['prsnumber']:'');
	$family = isset($_GET['family']) ? $_GET['family'] : (isset($_POST['family'])?$_POST['family']:'');
	$given = isset($_GET['given']) ? $_GET['given'] : (isset($_POST['given'])?$_POST['given']:'');

/* --------------------- Validation Check Start ----------------------------	*/

	if ($err)		$err="Error flagged before validation." ;
	$error = exapi_lang("Error") ;
	$result = $adodb->query("SELECT sum(amount) as amount FROM ${pre}acc_trans");
	$rs = $result->fetchRow() ;
	$net = sprintf($ck_nbrfmt,$rs['amount']) ;
	if ($net<>0)		$err=exapi_lang("Dr/Cr Imbalance detected.  Pls inform System Admin immediately.") ;

	if (strlen($prsnumber)>15)		$err="[".$prsnumber."]".exapi_lang("Search string too long") ;
	if (strlen($family)>15)			$err="[".$family."]".exapi_lang("Search string too long") ;
	if (strlen($given)>15)			$err="[".$given."]".exapi_lang("Search string too long") ;
	if ($err)		$err = "<b>$error: $err</b>" ;

/* --------------------- Validation Check Complete -------------------------	*/

	if (!$err)	{
		switch ($actnum) {
			case 1:
				$markpri = "zzAnDzz" ;  $marksec = "z2z1z3z" ; $filter = '' ;
				if ($prsnumber)		$filter .= "${markpri}6prsnumber${marksec}$prsnumber" ;
				if ($family)		$filter .= "${markpri}6family${marksec}$family" ;
				if ($given)		$filter .= "${markpri}6given${marksec}$given" ;
				$filter = urlencode($filter) ;
				$getstr = "phone=$phone&mphone=$mphone&email=$email&" ;
				$getstr.= "im=$im&fax=$fax&url=$url&address=$address&" ;
				$getstr.= "filter=$filter" ;
				Header('Location: '.exapi_link("/$app/empcontactlist.php",$getstr));exit();
			case 2:	Header('Location: '.exapi_link("/$app/elistfilter.php"));	exit();
			case 3:	Header('Location: '.exapi_link("/$app/elistfilter.php"));	exit();
			case 4:	Header('Location: '.exapi_link("/$app/elistfilter.php"));	exit();
			case 5:	Header('Location: '.exapi_link("/$app/elistfilter.php"));	exit();
			default:
				echo exapi_lang("Should not be here.  Weird Report Number") ;		exit();
			}
		}
	else
		{
		$getstr = "phone=$phone&mphone=$mphone&email=$email&" ;
		$getstr.= "im=$im&fax=$fax&url=$url&address=$address&" ;
		$getstr.= "prsnumber=$prsnumber&family=$family&given=$given&" ;
		$getstr.= "actnum=$actnum&err=$err" ;
		Header('Location: '.exapi_link("/$app/${tran}filter.php",$getstr));
		exit() ;
		}

?>
Return current item: CK-ERP