MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/celkcksm/jcboseedu.org/admin/include/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/jcboseedu.org/admin/include/function.php
<?php
function getExtension($str){
							 $i = strrpos($str,".");
							 if (!$i) { return ""; }
							 $l = strlen($str) - $i;
							 $ext = substr($str,$i+1,$l);
							 return $ext;
						}
function ak_img_resize($target, $newcopy, $w, $h, $ext) {
    list($w_orig, $h_orig) = getimagesize($target);
    $scale_ratio = $w_orig / $h_orig;
    if (($w / $h) > $scale_ratio) {
            $h = $w;
    }
    $img = "";
    $ext = strtolower($ext);
    if ($ext == "gif"){ 
      $img = imagecreatefromgif($target);
    } else if($ext =="png"){ 
      $img = imagecreatefromjpeg($target);
    } else { 
      $img = imagecreatefromjpeg($target);
    }
    $tci = imagecreatetruecolor($w, $h);
    // imagecopyresampled(dst_img, src_img, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h)
    imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
    imagejpeg($tci, $newcopy, 80);
}
function compress_image($source_url, $destination_url, $quality,$newcopy, $w, $h) {

		$info = getimagesize($source_url);

    		if ($info['mime'] == 'image/jpeg')
        			$image = imagecreatefromjpeg($source_url);

    		elseif ($info['mime'] == 'image/gif')
        			$image = imagecreatefromgif($source_url);

   		elseif ($info['mime'] == 'image/png')
        			$image = imagecreatefrompng($source_url);

    		imagejpeg($image, $destination_url, $quality);
			list($w_orig, $h_orig) = getimagesize($destination_url);
			$scale_ratio = $w_orig / $h_orig;
			if (($w / $h) > $scale_ratio) {
				     $h = $w;
			}
			$tci = imagecreatetruecolor($w, $h);
		  //imagecopyresampled(dst_img, src_img, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h)
			imagecopyresampled($tci, $image, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
			imagejpeg($tci, $newcopy, 80);
			return $destination_url;
} 
function get_property_type($id) {
	$uresult=fableela_mysql_query("select * from property_type where id=".$id);
	$proparty=fableela_fetch_array($uresult);
	
	return $proparty;
}
function sanitize($data) {
		// remove whitespaces (not a must though)
		$data = trim($data);

		// apply stripslashes if magic_quotes_gpc is enabled
		if (get_magic_quotes_gpc()) {
			$data = stripcslashes($data);
		}

		// a mySQL connection is required before using this function
		$data = fableela_escape_string($data);
		$data = quotes_to_entities($data);
		return $data;
	}
	 function quotes_to_entities($str) {
		return htmlspecialchars($str);
		//return str_replace(array("\'","\"","'",'"','<', '>'), array("&#39;","&quot;","&#39;","&quot;","&lt;","&gt;"), $str);
	}
 function cgi($tbl, $fl, $vl, $prn='') {

		$tblname = $tbl;
		$fields = $fl;
		$values = $vl;

		$sql.= "INSERT INTO " . $tblname . " ";

		$fieldnames.="(";
		if (is_array($fields)) {
			for ($i = 0; $i < sizeof($fields); $i++) {
				$fieldnames.= $fields[$i];
				if ($i < sizeof($fields) - 1)
					$fieldnames.= ", ";
			}
			$fieldnames.= ") ";

			$value.= " VALUES (";
			if (sizeof($values) > 0) {
				for ($i = 0; $i < sizeof($values); $i++) {
					//$value.= "'".$values[$i]."'";
					$value.= "'" . sanitize($values[$i]) . "'";
					if ($i < sizeof($values) - 1)
						$value.= ", ";
				}
			}
			$value.= ")";
		}
		else {
			$fieldnames .= $fields . ')';
			$value = " VALUES " . "('" . $values . "')";
		}
		$query = $sql . $fieldnames . $value;
		if ($prn) {
			echo $query;
		}

		$result = fableela_mysql_query($query) or die(fableela_error());
		return fableela_insert_id();
	}
	function cupdt($tbl='', $sf='', $sv='', $wf='', $wv='', $prn='')
		{
			$query="";
			$update_vars="";
			$condition="";
			$query.=" UPDATE ".$tbl." SET " ;			 
			
			/* Here updating fields and values are composed */
			
			if(is_array($sf))
			{
				if(sizeof($sf) > 0)
				{
					for($j=0; $j<sizeof($sf); $j++)
					{			
						$update_vars.= " $sf[$j] = '$sv[$j]' ";
						
						if($j<sizeof($sf)-1)
						$update_vars .= ", "; 
					}
				}
			}
			else
			{
				$update_vars.= " $sf = '$sv' ";
			}
				
			$query.= $update_vars;
			
			/*Here condition is created*/
			
			if(is_array($wf))
			{
				if(sizeof($wf) > 0)
				{
					for($k=0; $k<sizeof($wf); $k++)
					{			
						$condition.= " $wf[$k] = '$wv[$k]' ";
						
						if($k<sizeof($wf)-1)
						$condition .= " and "; 
					}
				}
			}	
			else
			{
				if($wf)
					$condition = $wf." = '$wv' ";
				else
					$condition="1";
			}
			$query.= " WHERE $condition ";
			if($prn==1)
			{
				echo $query;
			}
			//echo $query;
			$result = fableela_mysql_query($query) or die(fableela_error());
			return $result;
		}	
		function cgs($tbl='', $sf='', $wf='', $wv='', $ob='', $ot='', $prn='') {
			$condition="";
			
		$sql = "SELECT ";
		if (is_array($sf)) {
			$fields = implode(",", $sf);
		} else {
			if ($sf)
				$fields = $sf;
			else
				$fields = "*";
		}
		if (is_array($wf)) {
			$cntwf = sizeof($wf);
			if ($cntwf > 0) {
				for ($j = 0; $j < $cntwf; $j++) {
					if (is_numeric($wv[$j]))
						$condition.= " " . $wf[$j] . "=" . fableela_escape_string($wv[$j]) . " ";
					else
						$condition.= " " . $wf[$j] . "='" . fableela_escape_string($wv[$j]) . "' ";

					if ($j < $cntwf - 1)
						$condition .= " and ";
				}
			}
		}
		else {
			if ($wf)
				$condition = " $wf = '$wv' ";
			else
				$condition = "1";
		}
		$query = $sql . '' . $fields . " FROM " . $tbl . " WHERE " . $condition;
 $query;
		if ($ob) {
			$query.=" ORDER BY " . $ob;
		}
		if ($ot) {
			$query.=" " . $ot;
		}
		if ($prn) {
			echo $query;
		}

		$result = fableela_mysql_query($query) or die(fableela_error());
		$num = fableela_num_rows($result);
	//	print_r($num );
		if ($num < 1) {
			$retval = "n";
		} else {
			$retval = $result;
		}
//echo $retval;
		return $retval;
	}
	function gdel($tbl='', $wf='', $wv='', $prn='') {
$query='';
		$query.=" DELETE FROM  " . $tbl;
		if (is_array($wf)) {
			if (sizeof($wf) > 0) {
				for ($j = 0; $j < sizeof($wf); $j++) {

					$condition.=" $wf[$j] = '$wv[$j]'";
					if ($j < sizeof($wf) - 1)
						$condition.=" and";
				}
			}
		}
		else {
			$condition = "$wf = '$wv'";
		}
		$query.=" WHERE $condition ";
		if ($prn) {
			echo $query;
			exit;
		}
		$result = fableela_mysql_query($query) or die(fableela_error());
		return $result;
		
	}
	
	?>

MMCT - 2023