<?php    session_start(); 
 include("../DBConfig/Connection.php"); 
 include("../DBConfig/function.php");
 include("../MobileDetect/Mobile_Detect.php");
 $detect=new Mobile_Detect();

 
function generateRandom($length=6)
{
	$_rand_src = array(
		array(48,57) //digits
		//, array(97,122) //lowercase chars
//		, array(65,90) //uppercase chars
	);
	srand ((double) microtime() * 1000000);
	$random_string = "";
	for($i=0;$i<$length;$i++){
		$i1=rand(0,sizeof($_rand_src)-1);
		$random_string .= chr(rand($_rand_src[$i1][0],$_rand_src[$i1][1]));
	}
	return $random_string;
}
 

 

function savelogs($connect,$affiliates_landing_id,$affiliates_landing_affID,$landingPage_id,$action,$trans,$device='',$userAgent='',$puid){
	
	
	
	
	
	$logs=mysqli_query($connect,"insert into affil_landinglogs set affil_landingLogs_date=now(),
affil_landingLogs_affLandID='".$affiliates_landing_id."',
affil_landingLogs_affid='".$affiliates_landing_affID."',
affil_landingLogs_landingID='".$landingPage_id."',
affil_landingLogs_ip='".$_SERVER['REMOTE_ADDR']."'
,affil_landingLogs_sessionid='".session_id()."'
,affil_landingLogs_action='".$action."'
,affil_landingLogs_trans='".mysqli_real_escape_string($connect,$trans)."'
,affil_landingLogs_device='".$device."'
,affil_landingLogs_agent='".$_SERVER['HTTP_HOST']."'
,affil_landingLogs_pubid='".$puid."'
"); 

	



	}


 if($_REQUEST['opt']==1){
	 


	 /*
	 0= sucess
	 1= please fill all feilds 
	 2= cant add 
	 3= thank you 
	  4= virification Wrong
	5==  already subscribe  or wrong from JAwwal 
	  */ 
	  
	  if($_REQUEST['optV']==1 && $_REQUEST['vkey']!=''){ 
	  
	  
	 
	  
	  
	  
	   
		  
		  
		  $sessionID=session_id();
		  if($_REQUEST['fromlink']==1){
			$SelectCodesLink=mysqli_query($connect,"SELECT * FROM `LinksCode` WHERE `LinksCode_code`='".post($connect,$_REQUEST['linkCode'])."' ");

$rowLinkCode=mysqli_fetch_array($SelectCodesLink);
$sessionID=$rowLinkCode['LinksCode_sessionID'];
			  
			  
			  }
		  
		  
		  
		  
		  
		   
			  /// beforAPI 
			    $insertLogs=mysqli_query($connect,"insert into LogsForSubs set  
LogsForSubs_date=now(),
LogsForSubs_ip='".$_SERVER['REMOTE_ADDR']."',
 LogsForSubs_codeKey='".post($connect,$_REQUEST['vkey'])."',
  LogsForSubs_session='".$sessionID."' 
   , LogsForSubs_transIDFromURL='".post($connect,$_REQUEST['hash'])."'
  ,LogsForSubs_lid='".post($connect,$_REQUEST['landingID'])."'
  ,LogsForSubs_Aid='".post($connect,$_REQUEST['affID'])."'
  
  ");
  $idLogs=mysqli_insert_id($connect);
			  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  $selectSubscriberLogs=mysqli_query($connect,"select * from SubscribersLogs
		    where /*SubscribersLogs_verificationCode='".post($connect,$_REQUEST['vkey'])."' and */ 
			SubscribersLogs_sessionid='".$sessionID."'
			and SubscribersLogs_date > date_sub(now(), interval 10 minute)
			and    SubscribersLogs_affTransID='".post($connect,$_REQUEST['hash'])."'
			and SubscribersLogs_landingid='".post($connect,$_REQUEST['landingID'])."'
            and SubscribersLogs_affi='".post($connect,$_REQUEST['affID'])."'
			
			
		   ");
		   
		   
		  
		  
		  
		  
		  
		  
		  
		  
		  while($row=mysqli_fetch_assoc($selectSubscriberLogs)){
			  
			  
			  $selectServiceOperator=mysqli_query($connect,"SELECT * from    servicesoperator   
where servicesoperator_id='".$row['SubscribersLogs_serviceoperator']."'");
$serviceOperatorD=mysqli_fetch_array($selectServiceOperator);
			  
			  
			 

			  
			  
			  
			  /// beforAPI 
			    $insertLogs=mysqli_query($connect,"update  LogsForSubs set  
  LogsForSubs_mobile='".$row['SubscribersLogs_phone']."',
  LogsForSubs_transID='".$row['SubscribersLogs_affTransID']."'
    where LogsForSubs_id='". $idLogs."'
  
  ");
  
  
  
			  
			  
			  
			 
   require_once('lib/nusoap.php');
  


 $client = new soapclient('http://palsms.ps/APIs/index1.php?wsdl', true);
 
  
	 
$proxy = $client->getProxy();
       $resultReturn = $proxy->Subscribtion($row['SubscribersLogs_phone'],$serviceOperatorD['ServicesOperator_sid'],$serviceOperatorD['ServicesOperator_key'],post($connect,$_REQUEST['vkey']),$_SERVER['REMOTE_ADDR'],'');   
	
	
	$uodateLogs="";
	if($resultReturn=='0'){
		$uodateLogs=" , SubscribersLogs_status=1
		,SubscribersLogs_dateVerification=now()   ";
		}
	
	
			  $uodateLogs=mysqli_query($connect," update SubscribersLogs set 
			  hadaraAPILogs='".$resultReturn."'
			  ".$uodateLogs."
			   where SubscribersLogs_id='".$row['SubscribersLogs_id']."'
			  /* and   (hadaraAPILogs!='0' or hadaraAPILogs is null)	*/   
			   
			   
			   ");
			  
			  
			  
			  
			  
			  
			  $updateLogs =mysqli_query($connect,"
			  update LogsForSubs set LogsForSubs_APIReturn='".$resultReturn."',LogsForSubs_APIReturnDate=now()
			   where LogsForSubs_id='". $idLogs."'
			  ");
			  
	 
//print_r( $result);

// 0 sucess from jawwal 
// -1 wrong from jawwal 
 
		 // 10 no service 
 // 11 wrong Entry 
  // 12 inserted 
   // 13 cant insert 
   
   
   	  
			  
			  
			  /*
			  
			   $chargingAPI=file_get_contents("http://www.offers.ps/platform/ChargingAPI.php?mobile=".$row['SubscribersLogs_phone']."&servid=".$row['SubscribersLogs_serviceID']."");
			  
			   $return=json_decode($chargingAPI);
	 */
			//  echo("ddddddd".$result."ddd");
			 // sleep(5);
			  $sucessCharging =0;
			  
			  if($resultReturn=='0'    && is_numeric($resultReturn) ){ //charging is successfully 
			   $sucessCharging =1;
			  $insertSubs=mysqli_query($connect,"
			  
			  
			  insert into Subscribers set
		    Subscribers_phone='".$row['SubscribersLogs_phone']."',
			 Subscribers_serviceID='".$row['SubscribersLogs_serviceID']."', 
		   Subscribers_landingid='".$row['SubscribersLogs_landingid']."', 
		    
			  Subscribers_affi='".$row['SubscribersLogs_affi']."', 
			Subscribers_verificationCode='".$row['SubscribersLogs_affi']."'/*,
			 Subscribers_status='".$row['SubscribersLogs_status']."'*/
			 ,Subscribers_date=now()
			 ,Subscribers_sessionid='".$row['SubscribersLogs_sessionid']."'
			 ,Subscribers_sessionidExpired='".$row['SubscribersLogs_sessionidExpired']."'
			 ,Subscribers_operatorID='".$row['SubscribersLogs_operatorID']."'
			  ,Subscribers_serviceoperator='".$row['SubscribersLogs_serviceoperator']."'
			  ,Subscribers_sublogid='".$row['SubscribersLogs_id']."'
			  ,Subscribers_affTransID='".$row['SubscribersLogs_affTransID']."'
			  ,Subscribers_status=1
			   ,Subscribers_pubid='".$row['SubscribersLogs_pubid']."'
			  
			  
			  ");
			   
			  
			  $selectAffilatesDate=mysqli_query($connect,"SELECT * FROM `affiliates`
			   WHERE  `affiliates_id`='".$row['SubscribersLogs_affi']."' ");
			   $rowAffileData=mysqli_fetch_array( $selectAffilatesDate);
			  
			  //Send To Affiliate Transcation ID
			  
			  
			  $subid=mysqli_insert_id($connect);
			  
			  
			  
			  /* 
			   $returnaff=json_decode($affilAPI);*/
			   
			   
	$conversionLink= $rowAffileData['affiliates_link_conv'];		   
			  $conversionLink=str_replace("{{Hash}}",post($connect,$_REQUEST['hash']) , $conversionLink);
			
			   $affilAPI=file_get_contents($conversionLink );
			  
			   
			   
	 
			  
 $sel=mysqli_query($connect,"insert into `affAPILogs` set 
`affAPILogs_date`=now(), 
`affAPILogs_transID`='".post($connect,$_REQUEST['hash'])."',
`affAPILogs_subID`=". $subid.",
`affAPILogs_subLogID`=".$row['SubscribersLogs_id'].",
`affAPILogs_APIReturn`='".$returnaff->return."'
,affAPILogs_APIReturntext='".$affilAPI."'
,affAPILogs_affid='".$row['SubscribersLogs_affi']."'
,affAPILogs_pubid='".post($connect,$_REQUEST['hash2'])."'
,affAPILogs_Link='".$conversionLink."'
");
			  
			  
			 // exit($conversionLink);
			  
			 /* echo($rowAffileData['affiliates_link_conv']."1<br>");
			  ?><img src="http://sign.route-conversion.com/conversion_get/pixel.jpg?kp=jPS2567G0000001003DH0S2ST02OD7WF0TPC1L94872G000602OD700"><?php  
		   echo($affilAPI);
			  exit();	 */ 
			  
			  
			 // echo("subscriber added ");
			 // sleep(5);
			  
			    session_regenerate_id() ;
	  	 go("index.php?e=3&L=".post($connect,$_REQUEST['L'])."&A=".post($connect,$_REQUEST['A'])."&hash=".post($connect,$_REQUEST['hash'])."&hash2=".post($connect,$_REQUEST['hash2'])."");
	  exit();
	  // suceess 
	  
	  
			  } elseif($resultReturn==11){
			    go("index.php?e=4&L=".post($connect,$_REQUEST['L'])."&A=".post($connect,$_REQUEST['A'])."&hash=".post($connect,$_REQUEST['hash'])."&hash2=".post($connect,$_REQUEST['hash2'])."");
			    // wrong entry  
			    exit();
			  
			  
			  }else{
				  
				  if($resultReturn=='-1'
				   ){
				   session_regenerate_id() ;
				  }
	  	 go("index.php?e=5&L=".post($connect,$_REQUEST['L'])."&A=".post($connect,$_REQUEST['A'])."&hash=".post($connect,$_REQUEST['hash'])."&hash2=".post($connect,$_REQUEST['hash2'])."");
				  exit();
				  
				  
				  
				  
				  
				  
				  
				  
				  }
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  }
		  
		  
		  
		  
		  
		  
		  
		 
	  
	  
	  
	  
	 
	  
	  
	  }else{
		  
		  
		  // add new subscriber 
 
	 
	 if(  strlen($_REQUEST['mobile'])==10 && substr($_REQUEST['mobile'],0,2)=='05'
	 &&  (substr($_REQUEST['mobile'],0,3)=='059' || substr($_REQUEST['mobile'],0,3)=='056')
	 
	 
	 ){
		 
		 
		 
		 
 $selectOperatiorPrefex=mysqli_query($connect,"SELECT * FROM `operatorprefix`  inner join servicesoperator
on `operatorPrefix_operatorID`=`ServicesOperator_operatorID`
where `ServicesOperator_servicesID`='".$_REQUEST['serviceid']."'
and `operatorPrefix_pref`='".substr($_REQUEST['mobile'],0,3)."'");
 
		 $RowOperatorPrefex=mysqli_fetch_array($selectOperatiorPrefex);
		 
		 if(mysqli_num_rows($selectOperatiorPrefex)==0){
			  	 go("indexmw.php?e=3&L=".post($connect,$_REQUEST['L'])."&A=".post($connect,$_REQUEST['A'])."&hash=".post($connect,$_REQUEST['hash'])."&hash2=".post($connect,$_REQUEST['hash2'])."");
	  exit();
			 
			 }
		 
		 
		 
		 
		 
		 
		 
		 
		 
	//	 $Prefix=explode("*",$_REQUEST['prefix']);
		 
		 
		 $phone=post($connect,$_REQUEST['mobile']);
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
	 
$selecLandingPage=mysqli_query($connect,"select * from landingpage
where landingPageCode='".$_REQUEST['landCode']."'");
$rowLadingPage=mysqli_fetch_array($selecLandingPage);


 

 $selectAffileLand=mysqli_query($connect,"select * from affiliates_landing 
 where affiliates_landing_landingId='".$rowLadingPage['landingPage_id']."'
 and affiliates_landing_CodeID='".$_REQUEST['affCode']."'
 
 
 ");

 





if(mysqli_num_rows( $selectAffileLand)==0){
	echo("Wrong Affilites ID");
	exit();
	}

$rowAffile=mysqli_fetch_array($selectAffileLand);
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		   $SelectNumOfSubs=mysqli_query($connect,"select * from SubscribersLogs
where SubscribersLogs_phone='".$phone."' and 
date(SubscribersLogs_date)=date(now())
and SubscribersLogs_sessionid='".session_id()."'
and SubscribersLogs_serviceID='".$_REQUEST['serviceid']."'
");
			 
			 
			 if(mysqli_num_rows($SelectNumOfSubs) < 10){
		 
		 
		/* $insert=mysqli_query($connect," insert into affil_landinglogs 
		 set affil_landingLogs_date=now(),
		  affil_landingLogs_affLandID,
		   affil_landingLogs_affid, 
		   affil_landingLogs_landingID, 
		   affil_landingLogs_ip='".$_SERVER['REMOTE_ADDR']."'");*/
		   
		   $insert=mysqli_query($connect," insert into SubscribersLogs set
		    SubscribersLogs_phone='".$phone."',
			 SubscribersLogs_serviceID='".$_REQUEST['serviceid']."', 
		   SubscribersLogs_landingid='".$rowLadingPage['landingPage_id']."', 
		    
			  SubscribersLogs_affi='".$rowAffile['affiliates_landing_affID']."', 
			SubscribersLogs_verificationCode='".generateRandom(6)."',
			 SubscribersLogs_status=0
			 ,SubscribersLogs_date=now()
			 ,SubscribersLogs_sessionid='".session_id()."'
			 ,SubscribersLogs_sessionidExpired=date_add(now(), interval 3 minute)
			 ,SubscribersLogs_operatorID='". $RowOperatorPrefex['ServicesOperator_operatorID']."'
			  ,SubscribersLogs_serviceoperator='".$RowOperatorPrefex['ServicesOperator_id']."'
			  ,SubscribersLogs_affTransID='".post($connect,$_REQUEST['hash'])."'
			 , SubscribersLogs_pubid='".post($connect,$_REQUEST['hash2'])."'
			  
			 ");
		   
		   
		    
		   
		 if($insert){
			 
			
			 
			 $linkCode=generateRandom(8);
			 
			 $isertLinksCode=mysqli_query($connect,"insert into `LinksCode`  set `LinksCode_date`=noW(), `LinksCode_code`='".generateRandom(8)."', `LinksCode_link`='".$_SERVER['REQUEST_URI']."'
			 ,LinksCode_sessionID='".session_id()."'
			  ");
			 
			 
			 
			 
			 
			 
			 
			 
			    require_once('lib/nusoap.php');
 $client = new soapclient('http://palsms.ps/APIs/index1.php?wsdl', true);
 
  
	 
$proxy = $client->getProxy();
    $result = $proxy->Subscribtion($phone,$RowOperatorPrefex['ServicesOperator_sid'],$RowOperatorPrefex['ServicesOperator_key'],'',$_SERVER['REMOTE_ADDR'],$linkCode);  
	
//print_r( $result);
			 
		  
			  $e=0;
			 }else{
				  $e=2;
				 }		 
			 }else{
				 
				   $e=1;
				 }
		 
		 }else{
			 $e=1;
			 }
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 go("index.php?e=".$e."&L=".post($connect,$_REQUEST['L'])."&A=".post($connect,$_REQUEST['A'])."&hash=".post($connect,$_REQUEST['hash'])."&hash2=".post($connect,$_REQUEST['hash2'])."");
	 
	 
	 
	 
 }
	 
	 
	 
	 
	 
	 
	 
	 
	 }else{
 ?>
 
 
 <?php





//echo("fff".$_GET['L']);


$LandingCode=$_REQUEST['L'];
$affiliateID=$_REQUEST['A'];




// get landing data
$selecLandingPage=mysqli_query($connect,"select * from landingpage
where landingPageCode='".$LandingCode."'");

// echo("select * from landingpage where landingPageCode='".$LandingCode."'");

$rowLadingPage=mysqli_fetch_array($selecLandingPage);

 


 
// get affiliate data
 $selectAffileLand=mysqli_query($connect,"select * from affiliates_landing 
 where affiliates_landing_landingId='".$rowLadingPage['landingPage_id']."'
 and affiliates_landing_CodeID='".$affiliateID."'
  ");

 





if(mysqli_num_rows( $selectAffileLand)==0){
	echo("Wrong   ID");
	exit();
	}

$rowAffile=mysqli_fetch_array($selectAffileLand);





// get service Data
$selService=mysqli_query($connect,"  select * from servicesoperator inner join services
 on Services_id=ServicesOperator_servicesID
 inner join landingserviceoperator 
 on landingServiceOperator_serOpID=ServicesOperator_id
where  landingServiceOperator_landingid=".$rowLadingPage['landingPage_id']."
group by 
 Services_id");
 


$rowService=mysqli_fetch_array($selService);










?>

    
    
    
    
    <?php 
 if(!isset($_REQUEST['e'])){
	 
	 $device="";
	 if ( $detect->isMobile() ) {
		 $device.='Mobile,';
		 
		 }elseif ( $detect->isTablet() ) {
		 $device.='Tablet,';		 
		 }else{
			 
			 $device.="desktop,";
			 
			 }
		 
			 
			 
			 
		 
		 if( $detect->isiOS() ){
			  $device.='ios,';
 
}
 
if( $detect->isAndroidOS() ){
	 $device.='android,';
 
}
		 
	$userAg=$detect->getUserAgent()	 ;
	//$userAg=$detect->getDetectionType();
		 
	 
	savelogs($connect,$rowAffile['affiliates_landing_id'],$rowAffile['affiliates_landing_affID']
	,$rowLadingPage['landingPage_id'],"View",post($connect,$_REQUEST['hash']),$device,$userAg,post($connect,$_REQUEST['hash2']));
 }
	?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Khalid Al-araj">
    <title><?php 	echo($rowLadingPage['landingPage_Title']); ?></title>

    <!-- Bootstrap -->
    <link href="../css/landingPage/bootstrap.min.css" rel="stylesheet">
    <!-- style -->
    <link href="../css/landingPage/landing_style1.css" rel="stylesheet">

    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    <style>body{ background-color:<?php 	echo($rowLadingPage['landingPage_BG']); ?>;
	
	}</style>
    <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-6011451-8', 'auto');
  ga('send', 'pageview');

</script>
</head>
<body>

<div class="container-fluid">
  <?php /*?>  <div class="row">
        <div class="col-lg-12">
            <label class="service-label"> <?php 	echo($rowLadingPage['landingPage_Title']); ?></label>
        </div>
    </div><?php */?>
  <?php  if($_REQUEST['L']=='4741291'){?>  
  <div class="row" style="    background-color: #dd052b;
    border-bottom: 2px solid #fff;">
        <div class="col-lg-12">
            <!--            <label class="shasha-label"> <span class="com100100">100%</span> وطنية </label>-->
            <img style="max-width: 200px;margin: 20px auto;" class="img-responsive" src="images/wm_logo.png">
        </div>
    </div>
    <br>

<?php } ?>
    
    
    
    
        <?php  
 $selectSubscriber=mysqli_query($connect,"select * from SubscribersLogs
 where SubscribersLogs_sessionid='".session_id()."'
 and SubscribersLogs_sessionidExpired > now()
 and SubscribersLogs_landingid='".$rowLadingPage['landingPage_id']."'
 and SubscribersLogs_affi='".$rowAffile['affiliates_landing_affID']."'
 and SubscribersLogs_affTransID='".post($connect,$_REQUEST['hash'])."'
 ");
 
 $numberOfid=mysqli_num_rows($selectSubscriber);
  ?>
    
          
       <?php 
 
 if( $numberOfid==0){ 
  ?>
    <div class="row banner">
        <div class="col-xs-12 col-sm-12">
            <div class="image-container"<?php /*?> onClick="playaudi();"<?php */?><?php /*?> style="cursor:pointer"<?php */?>>
            
            
          <?php /*?>  <div id="playvedioDiv"  onClick="playaudi();"> <img src="landingPageFiles/play.png"></div><?php */?>
        <?php /*?>  <span class="play-btn" ></span>
          <span class="play-btn-hover"  ></span><?php */?>
              <img class="img-responsive jw2zna" src="landingPageFiles/<?php  echo($rowLadingPage['landingPage_image']); ?>" />  
              
                 <?php  //include("audioVedio.php"); ?>
                <?php if($_REQUEST['L']=='4741292'){ ?> 
                <?php   include("audio.php"); ?>
                <?php }  ?>
                
                
               <?php /*?> <img class="img-responsive jw2zna img-logo" src="../LandingPageImages/images/huawei.png" /><?php */?>
            </div>
        </div>
    </div> 
    <?php }  ?>
    
    
    <div class="row">
        <div class="col-xs-12">
           
           
           
           
           
       <?php 
 
 if( $numberOfid==0){ 
  ?>
  
  
  
  
  
  
  <script>
  function phonenum(){
  var phone=document.getElementById("mobile").value
// phone='05'+phone;
	 var Message='';
	 
	 <?php  if($_REQUEST['L']=='4741291'){?>  
	 
	  if(    phone.substring(0, 3)=='056'){}else{
		// alert('خطا في رقم الهاتف , يجب ان يبدا في 059');
	
		//return false;
		Message=Message + 'خطا في رقم الهاتف , يجب ان يبدا في  056 \n\r';
		
		 
		 }
		 
		 
	 
	 <?php } else{ ?>
	 if(   phone.substring(0, 3)=='059' ||  phone.substring(0, 3)=='056'){}else{
		// alert('خطا في رقم الهاتف , يجب ان يبدا في 059');
	
		//return false;
		Message=Message + 'خطا في رقم الهاتف , يجب ان يبدا في 059 او 056 \n\r';
		
		 
		 }
		 
		 <?php }  ?>
		 
		 
		 
	   if(phone.length  != 10 )
		{
		//alert('خطا في رقم الهاتف , يجب ان يكون من 8 ارقام');
	Message=Message + 'خطا في رقم الهاتف , يجب ان يكون من 10 ارقام';
		//return false;
		 
		
		 }   
	 if(Message!=''){
		 alert(Message);
		 return false;
		 }
	 
	 
	 
	 
	 
	 
 
	 
	}
	
	
	
	
</script>
  
  
  
  
  
  <label class="service-label" dir="rtl"> <?php  echo($rowLadingPage['landingPage_introText']); ?></label>
    
    
    <form class="form-horizontal service-form" method="post" action="" onSubmit="return phonenum();">
    
     <input type="hidden" name="opt" value="1">
       <input type="hidden" name="landCode" value="<?php echo($rowLadingPage['landingPageCode']); ?>">
       <input type="hidden" name="affCode" value="<?php echo($affiliateID); ?>">
        <input type="hidden" name="hash" value="<?php echo(post($connect,$_REQUEST['hash'])); ?>">
         <input type="hidden" name="hash2" value="<?php echo(post($connect,$_REQUEST['hash2'])); ?>">
        <input type="hidden" name="serviceid" value="<?php echo($rowService['Services_id']); ?>">
    
    
    
    
    
    
    
    
    
    
                <div class="form-group ">
                   <div class="col-xs-12" >
                       <?php /*?> <span class="input-group-addon" id="basic-addon1"><?php   
	  
	  // get operator prefix 
	  
$selectDate=mysqli_query($connect,"
select 
operatorPrefix_pref,operatorPrefix_operatorID ,Operator_name,ServicesOperator_id

 from landingserviceoperator
inner join landingpage on landingPage_id=landingServiceOperator_landingid
inner join servicesoperator on ServicesOperator_id=landingServiceOperator_serOpID
inner join operator on Operator_id=ServicesOperator_operatorID
inner join operatorprefix on operatorPrefix_operatorID=Operator_id
where landingPage_id='".$rowLadingPage['landingPage_id']."'
group by ServicesOperator_id
");
if(mysqli_num_rows($selectDate)==1){
	$rowPrefix=mysqli_fetch_array($selectDate);
	echo($rowPrefix['operatorPrefix_pref']);
	?>
	<input type="hidden" name="prefix" value="<?php echo($rowPrefix['operatorPrefix_operatorID']); ?>*<?php echo($rowPrefix['operatorPrefix_pref']); ?>*<?php echo($rowPrefix['ServicesOperator_id']); ?>" >
	<?php 
	}else{
 ?>
                        
                        
                        <select name="prefix" id="prefix"     class="selectPrefex">
      <option value="0"> المقدمة </option>
      <?php 


while($rowPrefix=mysqli_fetch_array($selectDate)){
	  
	  ?>
	  <option value="<?php echo($rowPrefix['operatorPrefix_operatorID']); ?>*<?php echo($rowPrefix['operatorPrefix_pref']); ?>*<?php echo($rowPrefix['ServicesOperator_id']); ?>" ><?php   echo($rowPrefix['operatorPrefix_pref']); ?></option>
	  <?php } ?>
      </select>
       <?php } ?></span>
                        
                        <?php */?>
                        
                        
     
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        <input name="mobile" id="mobile"  type="text" class="form-control service-input"   placeholder="رقم المحمول" maxlength="10" value="05" dir="ltr"> 
مثال : <span dir="rtl">05xxxxxxxx</span>
                    </div>
                    

                </div>
                <button type="submit" class="btn btn-success service-button" style="
    background-color: <?php echo($rowLadingPage['landingPage_ssubmitColor']); ?>;  
   
"><?php echo($rowLadingPage['landingPageSubmitValue']); ?></button>
            </form>
    
    
    
 
  <?php }else{ ?>   
  
  
  
   <script>
  function verifiyVal(){
  var vkey=document.getElementById("vkey").value
// phone='05'+phone;
	 var Message='';
	 
		 
	   if(vkey=='' )
		{
		//alert('خطا في رقم الهاتف , يجب ان يكون من 8 ارقام');
	Message=Message + 'الرجاء ادخل رقم التفعيل ';
		//return false;
		 
		
		 }   
	 if(Message!=''){
		 alert(Message);
		 return false;
		 }
	 
	 
	 
	 
	 
	 
 
	 
	}
	
	
	
	
</script>
  
  
  
  
   <div class="row">
        <div class="col-xs-12" >
       
      <div style=" background:#999;width:50%; margin:auto; color:#FFF; padding:5px" >
            <label class="service-label" dir="rtl"> <?php if($_REQUEST['e']==0){ echo($rowLadingPage['landingPage_SubmitMessage']);} ?></label>
            <form class="form-horizontal service-form" method="post" action="" onSubmit="return verifiyVal();">
            
              <input type="hidden" name="opt" value="1">
    <input type="hidden" name="optV" value="1">
     <input type="hidden" name="hash" value="<?php echo($_REQUEST['hash']); ?>">
      <input type="hidden" name="hash2" value="<?php echo($_REQUEST['hash2']); ?>">       
        <input type="hidden" name="mobile" value="<?php echo($_REQUEST['mobile']); ?>"> 
        <input type="hidden" name="landingID" value="<?php echo($rowLadingPage['landingPage_id']); ?>">  
         <input type="hidden" name="affID" value="<?php echo($rowAffile['affiliates_landing_affID']); ?>">
        
        
                <div class="form-group ">
                    <?php /*?><label style="float: right" for="code" class="col-sm-2 control-label code-verify-label">كود التفعيل</label><?php */?>
                    <div class="col-sm-12">
                        <input type="text" name="vkey" id="vkey" class="form-control service-input"   maxlength="7" placeholder="رقم التفعيل">
                        
                    </div>
                </div>
                <button type="submit" class="btn btn-success service-button"  style="
    background-color: <?php echo($rowLadingPage['landingPage_ssubmitColor']); ?>;  
   
">متابعة</button>
                
               <?php /*?> <div id="timer"></div><?php */?>
            </form>
            
            </div>
             <?php  if($_REQUEST['x']==1 || 1==1 ){
				  //include("testcounter.php");
					
					} ?>
            
        </div>
    </div>
<?php /*?>  <script src="../js/countdown.js"></script><?php */?>
  <?php /*?><form id="form2" name="form2" method="post">
    <input type="hidden" name="opt" value="1">
    <input type="hidden" name="optV" value="1">
     <input type="hidden" name="t" value="<?php echo($_REQUEST['hash']); ?>">
      
      <input type="text" name="vkey" id="vkey" class="input"  placeholder="كود التفعيل">
      <input type="submit" name="submit2" id="submit2" value="ارسل" class="inputSubmit">
    </form> <?php */?>
    <?php }  ?>
           
           
       <?php /*?>    
           
           <center>
           
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=526741027343721";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


<div class="fb-like" data-href="https://www.facebook.com/offersps" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>
</center>
<?php */?>



           
            <div class="row">
        <div class="col-lg-12">
            <label class="service-label"> 
           <?php  
	
	switch($_REQUEST['e']){
		
	 
		case 1:
		// fill all feilds
		echo("الرجاء ادخل جميع الحقول");
		break;
		case 2:
		// e 
		echo($rowLadingPage['SubmitMessage_eVerificationMEssage']);
		break;
		
			case 3:
		// thank you 
		echo($rowLadingPage['SubmitMessage_thankYouMessage']);
		break;
			case 4:
		// verification Wrong 
		echo($rowLadingPage['SubmitMessage_wrongVerification']);
		break;
		case 5:
		// verification Wrong 
		echo("عذرا ، لا يمكنك الاستفادة من االخدمة  ");
		break;
		}
	
	
	 ?> </label>
        </div>
           
           
            <?php /*?><form class="form-horizontal service-form" method="post" action="subscribe.php">
                <div class="form-group <?php echo isset($_SESSION['e']) ? 'has-e' : null?>">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon1">056</span>
                        <input name="mobile" type="text" class="form-control service-input" id="phone-number" placeholder="Mobile Number" maxlength="7">
                    </div>
                    <?php if(isset($_SESSION['e'])):?>
                        <label class="control-label" for="phone-number"><?php echo $_SESSION['e']?></label>
                    <?php endif;?>

                </div>
                <button type="submit" class="btn btn-success service-button">أرسل</button>
            </form><?php */?>
            <div class="row">
                <div class="col-md-6 instructions">
                  <?php if($rowLadingPage['SubmitMessage_unsubmessage']!=''){ ?>  <P><?php 	echo($rowLadingPage['SubmitMessage_pricemessage']); ?></P>
                       <?php }  ?>
                    <?php if($rowLadingPage['SubmitMessage_unsubmessage']!=''){ ?><p class="info-subscribe text-danger">للإلغاء</p>
                    <P> <?php 	echo($rowLadingPage['SubmitMessage_unsubmessage']); ?></P>
                    <?php }  ?>
                   <?php if($rowLadingPage['landingPage_disclamer']!=''){ ?> <a data-toggle="modal" data-target="#roles" href="#">شروط الإستخدام</a><?php }  ?>
                    
                    
                    
                </div>
            </div> 
        </div>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="roles" tabindex="-1" role="dialog">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                     <h4 class="modal-title" id="myModalLabel">شروط الإستخدام</h4> 
                </div>
                <div class="modal-body">
                    <?php 	echo($rowLadingPage['landingPage_disclamer']); ?>
                </div>
            </div>
        </div>
    </div>
</div>
 <?php if($_REQUEST['L']!='4741292'){ ?>
<!-- JQuery -->
<script src="../js/jquery.min.js"></script>
<?php }  ?>
<!-- Bootstrap -->
<script src="../js/bootstrap.min.js"></script>
</body>
</html>
<?php  }  mysqli_close($connect); ?>
<?php //proc_close(); ?>