Well done! '.$msg.''; else if($type=='ERR') echo '
Warning! '.$msg.'
'; } function pg_link($url) { if($url) $ret = "home.php?".url_encode($url); else $ret = "home.php"; return $ret; } function admin_auth() { if(!$_SESSION["ADMIN_AREA"] || $_SESSION["ADMIN_AREA"]!="Active") header('Location:'.SITEURL.'login?msg=logout'); } function pagedisplay($page,$argu2,$nur,$argu1,$seltab) { global $mode,$pg,$con_id; //$argu2 = 'mode='.$mode.'&pg='.$pg.$argu2; //$argu2 = ''; if(!$page) $page=1; $page=$page-1; $seltab = strtolower($seltab); $cut_qr = strstr($seltab, 'from'); $Selqr = mysql_query("SELECT count(*) as cnt ".$cut_qr); $res3 = mysql_fetch_array($Selqr); $no = $res3['cnt'];//total number of record $qr = $seltab." limit ".$page.",".$nur; $res22 = mysql_query($qr); $nopages = ceil($no/$nur); // Number of records per page is 10 $str=""; $str.='"; $res[0] = $res22; $res[1] = $str; $res[2] = $no; return $res; } function pagedisplay2($start,$argu2,$nur,$argu1,$seltab) { global $mode,$pg,$con_id; //$argu2 = ''; if(!$start) $start=0; $seltab = strtolower($seltab); $cut_qr = strstr($seltab, 'from'); $Selqr = mysql_query("SELECT count(*) as cnt ".$cut_qr); $res3 = mysql_fetch_array($Selqr); $no = $res3['cnt'];//total number of record $qr = $seltab." limit ".$start.",".$nur; $res22 = mysql_query($qr); $nopages = ceil($no/$nur); // Number of records per page is 10 $str=""; $str.=""; $res[0] = $res22; $res[1] = $str; $res[2] = $no; return $res; } function _prepare_url_text_for_cat($string) { // remove all characters that aren't a-z, 0-9, dash, underscore or space $NOT_acceptable_characters_regex = '#[^-a-zA-Z0-9_ ]#'; $string = preg_replace($NOT_acceptable_characters_regex, '', $string); // remove all leading and trailing spaces $string = trim($string); //make all letters small $string = strtolower($string); // change all dashes, underscores and spaces to dashes $string = preg_replace('#[-_ ]+#', '-', $string); // return the modified string return $string; } function add_trim($string) { $string = strip_tags($string); return trim(addslashes($string)); } function strip($string) { return stripslashes($string); } function add_trim_upper($string) { return strtoupper(trim(addslashes($string))); } function ret_sql_date($date) { if($date){ $dt_ar= explode("-",$date); if(!$dt_ar[2]) $dt_ar= explode("/",$date); //$test3 = new DateTime($month.'/01/'.$year); $test = new DateTime($dt_ar[1].'/'.$dt_ar[0].'/'.$dt_ar[2]); return date_format($test, 'Y-m-d'); } else return ''; } function pg_sql_date($date) { if($date){ $dt_ar= explode("-",$date); $test = new DateTime($dt_ar[1].'/'.$dt_ar[2].'/'.$dt_ar[0]); return date_format($test, 'd-m-Y'); } else return ''; } function email_check($email) { $email = trim($email); if($email==''){ return false; }else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)){ return false; }else { return true; } } function num_check($num) { $num = trim($num); if(preg_match("/^[0-9]+$/",$num) && $num>0){ return true; } else{ return false; } } function value_check($val) { $val = trim($val); if($val==''){ return false; }else{ return true; } } function valuelength_check($val) { $val = trim($val); if(strlen($val)<3 || strlen($val)>255){ return false; }else{ return true; } } function price_display($val){ return number_format($val, 2, ".", ","); } function date_grater_today($sel_date) { $ch_date = false; if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$sel_date) && strtotime($sel_date) >= strtotime(date("Y-m-d"))) { $ch_date = true; }else{ $ch_date = false; } return $ch_date; } ?>