<?php 
		$id = $_GET['id'];
		$phone = $_GET['phone'];
		$shortcode = $_GET['shortcode'];
		$gateway = $_GET['gateway'];
		$sms = $_GET['sms'];
		$checksum = $_GET['checksum'];
		// Luu DB
		if(isset($id) && isset($phone) && isset($shortcode) && isset($gateway) && isset($sms) && isset($checksum)){			
			//echo hextobin($sms).'<br/>';
			$userkey = '';// VTDD cung cap
			$tong = $userkey . $id . $phone . $shortcode . $sms;			
			$server_checksum = md5($tong);
			// Kiem tra id co trung khong
			// Luu DB
			
			// Xu ly noi dung tin nhan
			echo 'Noi dung can tra cho khach hang';
		}else{
			echo 'LOI';
		}
		// Hex to String
		function hextobin($hexstr) 
		{ 
			$n = strlen($hexstr); 
			$sbin="";   
			$i=0; 
			while($i<$n) 
			{       
				$a =substr($hexstr,$i,2);           
				$c = pack("H*",$a); 
				if ($i==0){$sbin=$c;} 
				else {$sbin.=$c;} 
				$i+=2; 
			} 
			return $sbin; 
		}
		
?>