<?php  
if($_SESSION['role']!=1){ 
exit("You dont have permisiion to access this page ");}
?>
<?php  include("fckeditor.php") ; ?>
 <div>
    <ul class="breadcrumb">
        <li>
            <a href="index.php">Home</a>
        </li>
        <li>
            <a href="index.php?page=LandingPage"> Add Landing Page</a>
        </li>
    </ul>
</div>

<div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2><i class=" glyphicon glyphicon-th-list"></i> Landing Page</h2>

                    <div class="box-icon">
                        <a href="#" class="btn btn-setting btn-round btn-default"><i
                                class="glyphicon glyphicon-cog"></i></a>
                        <a href="#" class="btn btn-minimize btn-round btn-default"><i
                                class="glyphicon glyphicon-chevron-up"></i></a>
                        <a href="#" class="btn btn-close btn-round btn-default"><i
                                class="glyphicon glyphicon-remove"></i></a>
                    </div>
                </div>
                <div class="box-content">
                
                <br />

                
              
                 
                  <?php  
				 if($_REQUEST['opt']==do_up){
					if($_REQUEST['landingpage_name']==''
 
	){
		
		echo("<div style='color:red'> Please Fill All Parameters </div>");
		}else{
 
 
 
 
 
 
 
$insertSQL="";

echo($_FILES['landingPage_image']['name']);

	  if(upload("../LandingPage/landingPageFiles/",$_FILES['landingPage_image']['name'],$_FILES['landingPage_image']['tmp_name'])==1){ 

 
//if(move_uploaded_file($_FILES['landingPage_image']['tmp_name'], "../landingPageFiles/" . $_FILES["landingPage_image"]['name'])){


 $filename=time().".".Get_Extension_From_File($_FILES['landingPage_image']['name']);



 rename("../LandingPage/landingPageFiles/".$_FILES['landingPage_image']['name'],"../LandingPage/landingPageFiles/".$filename);

$insertSQL=$insertSQL." , landingPage_image='".$filename."'";

//echo("ffffffff");

}//4
//print_r(error_get_last());
 
 
 
 
 
 
 
 

 $landingpage_query="update landingpage
set 
landingpage_name='".post($connect,$_REQUEST['landingpage_name'])."'
  
, landingPage_servicesOperatorID='".post($connect,$_REQUEST['landingPage_servicesOperatorID'])."'
, landingPage_Title='".post($connect,$_REQUEST['landingPage_Title'])."'
, landingPage_introText='".post($connect,$_REQUEST['landingPage_introText'])."'
, landingPage_SubmitMessage='".post($connect,$_REQUEST['landingPage_SubmitMessage'])."'
, SubmitMessage_thankYouMessage='".post($connect,$_REQUEST['SubmitMessage_thankYouMessage'])."'
, SubmitMessage_errorVerificationMEssage='".post($connect,$_REQUEST['SubmitMessage_errorVerificationMEssage'])."'
, SubmitMessage_wrongVerification='".post($connect,$_REQUEST['SubmitMessage_wrongVerification'])."'
 
, landingPageSubmitValue='".post($connect,$_REQUEST['landingPageSubmitValue'])."'
 
, landingPage_BG='".post($connect,$_REQUEST['landingPage_BG'])."'
, landingPage_disclamer='".post($connect,$_REQUEST['landingPage_disclamer'])."'
, landingPage_servicesID='".post($connect,$_REQUEST['landingPage_servicesID'])."'
, SubmitMessage_pricemessage='".post($connect,$_REQUEST['SubmitMessage_pricemessage'])."'
, landingPage_pricesFlag='".post($connect,$_REQUEST['landingPage_pricesFlag'])."'

".$insertSQL."
 where landingpage_id='".post($connect,$_REQUEST['id'])."'
 
 
 ";
 
 
 
 $situation=mysqli_query($connect,$landingpage_query);
 if($situation){ 
$id =post($connect,$_REQUEST['id']);
  $situation=mysqli_query($connect,"delete from  landingserviceoperator
  where landingServiceOperator_landingid='".$id."'
   ");
  
 
 $serviceOerator=$_REQUEST['serviceOper'];
 for($i=0;$i<=sizeof( $serviceOerator);$i++){
	  $situation=mysqli_query($connect,"insert into landingserviceoperator 
set landingServiceOperator_landingid='".$id."'
,landingServiceOperator_serOpID=".$serviceOerator[$i]."");
 
	 
	 }
 
 
 
 
 
 
 
 
 
 echo("<div>landingpage Added SucessFully</div>");}
}}
				 ?>
                 
                 
                
                 
                 
                 
                 
                 <?php  
				 if($_REQUEST['opt']==up){
					 
					 $landingpage_q="select * from landingpage where landingpage_id=".post($connect,$_REQUEST['id']);
					$landingpage_res=mysqli_query($connect,$landingpage_q);
					if($landingpage_res){
						$landingpage_row=mysqli_fetch_assoc($landingpage_res);
					
					 }
				 ?>
                 
                         
                   
                  <fieldset>
<legend>Update  service</legend>      
                   
                 
                 
                 <form method="post"  class="login_form" enctype="multipart/form-data" >
<input type="hidden" name="opt" value="do_up" />
<input type="hidden" name="landingPage_id" value="<?php echo($landingpage_row['landingPage_id']); ?>" />


<div class="form-group">
<div class="row ">
<div class="col-md-2">Landing Page Name </div>
<div class="col-md-4"><input type="text" name="landingpage_name" id="landingpage_name" class="form-control" placeholder="Name"  value="<?php echo($landingpage_row['landingPage_name']); ?>"/></div>
 
<div class="col-md-2">Landing Page Title </div>
<div class="col-md-4"><input type="text" name="landingPage_Title" id="landingPage_Title" class="form-control" placeholder="Title"  value="<?php echo($landingpage_row['landingPage_Title']); ?>"/></div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Service Name  </div>
<div class="col-md-4"><select name="landingPage_servicesID" id="landingPage_servicesID" class="form-control"  data-rel="chosen" >
<option value="0">Select Services</option>
<?php $seloperator=mysqli_query($connect,"select * from services");


while($rowProv=mysqli_fetch_array($seloperator)){
	?>
	<option value="<?php echo($rowProv['Services_id']); ?>" <?php if($landingpage_row['landingPage_servicesID']==$rowProv['Services_id']){?> selected<?php } ?>><?php echo($rowProv['Services_name']); ?></option>
	<?php
	
	}
 ?>
</select></div>
 
<div class="col-md-2">Service </div>
<div class="col-md-4" id="ServicesOperator"> <?php 	$seloperator=mysqli_query($connect,"select * from servicesoperator where ServicesOperator_servicesID='".$landingpage_row['landingPage_servicesID']."'");

 //echo("select * from servicesoperator where ServicesOperator_servicesID='".$_REQUEST['servid']."'");

while($rowProv=mysqli_fetch_array($seloperator)){
 ?> 
 
 <div style="float:left">
<label for="checkbox"><?php echo($rowProv['ServicesOperator_name']); ?> </label>
<?php  	$seloperatorCheck=mysqli_query($connect,"select * from landingserviceoperator
 where landingServiceOperator_serOpID='".$rowProv['ServicesOperator_id']."'
and landingServiceOperator_landingid='".$landingpage_row['landingPage_id']."'"); 
 
?>

<input type="checkbox" name="serviceOper[]" value="<?php echo($rowProv['ServicesOperator_id']); ?>"
<?php if(mysqli_num_rows($seloperatorCheck)==1){ ?>checked<?php }  ?>

> &nbsp; &nbsp;</div>
 <?php }  ?>

 


</div>
</div>
</div>





 




 



<div class="form-group">
<div class="row ">
<div class="col-md-2">Intro Text  </div>
<div class="col-md-4"><textarea  name="landingPage_introText" id="landingPage_introText"  class="form-control" placeholder="Intro" rows="5" cols="50"><?php echo($landingpage_row['landingPage_introText']); ?></textarea> </div>

<div class="col-md-2">desclaimer Text  </div>
<div class="col-md-4"><textarea  name="SubmitMessage_pricemessage" id="SubmitMessage_pricemessage"  class="form-control" placeholder="Intro" rows="5" cols="50"><?php echo($landingpage_row['SubmitMessage_pricemessage']); ?></textarea> </div>






</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Show Disclamers text </div>
<div class="col-md-4"><input type="checkbox" value="1" name="landingPage_pricesFlag" id="landingPage_pricesFlag" <?php if($landingpage_row['landingPage_pricesFlag']==1) {?> checked <?php }  ?> >
</div></div></div>




<div class="form-group">
<div class="row ">
<div class="col-md-2">Submit Message</div>
<div class="col-md-4"><input type="text" name="landingPage_SubmitMessage" id="landingPage_SubmitMessage" class="form-control" placeholder="Submit Message" value="<?php echo($landingpage_row['landingPage_SubmitMessage']); ?>" /></div>
 
<div class="col-md-2">Thank You Message</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_thankYouMessage" id="SubmitMessage_thankYouMessage" class="form-control" placeholder="thank You Message"  value="<?php echo($landingpage_row['SubmitMessage_thankYouMessage']); ?>"/></div>
</div>
</div>



<div class="form-group">
<div class="row ">
<div class="col-md-2">Error Verification Message</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_errorVerificationMEssage" id="SubmitMessage_errorVerificationMEssage" class="form-control" placeholder="error Verification Message"  value="<?php echo($landingpage_row['SubmitMessage_errorVerificationMEssage']); ?>"/></div>
 
<div class="col-md-2">Wrong Verification</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_wrongVerification" id="SubmitMessage_wrongVerification" class="form-control" placeholder="Wrong Verification" value="<?php echo($landingpage_row['SubmitMessage_wrongVerification']); ?>"/></div>
</div>
</div>


 

<div class="form-group">
<div class="row ">
<div class="col-md-2">Submit Value</div>
<div class="col-md-4"><input type="text" name="landingPageSubmitValue" id="landingPageSubmitValue" class="form-control" placeholder="Submit Value"  value="<?php echo($landingpage_row['landingPageSubmitValue']); ?>"/></div>
 
<div class="col-md-2">Image</div>
<div class="col-md-4"><input type="file" name="landingPage_image"></div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">BG Color</div>
<div class="col-md-4"><input type="text" name="landingPage_BG" id="landingPage_BG" class="form-control" placeholder="BG Color"  value="<?php echo($landingpage_row['landingPage_BG']); ?>"/></div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Disclamer </div>
<div class="col-md-9"><?php /*?><textarea  name="landingPage_disclamer" id="landingPage_disclamer"  class="form-control" placeholder="Intro" rows="10" cols="50"><?php echo($landingpage_row['landingPage_disclamer']); ?></textarea><?php */?> 
<?php 
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor('landingPage_disclamer') ;
$oFCKeditor->BasePath	= $sBasePath ;
$oFCKeditor->Height	= '300' ;
$oFCKeditor->Value		= $landingpage_row['landingPage_disclamer'] ;
$oFCKeditor->Create() ;  ?>

</div>
</div>
</div>




<div class="form-group">
<div class="row ">

<div class="col-md-12 center"><input type="submit" name="Add_landingpage" value="Update Page" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
              


                       <br>
<br>
<br>
<br>






<br>
<br>   
                 
                 
                 
                 
              </fieldset>   
                 
                 
                 
                  <?php  
				 	}
				 ?>
                 
                 
                 
                
                 <!-----      end update landingpage       -->
                 
                
               <!-----       add landingpage       -->
                
                <?php 
				
			if($_REQUEST['opt']==do_add)
{
	
	if($_REQUEST['landingPage_name']==''
 
	){
		
		echo("<div style='color:red'> Please Fill All Parameters </div>");
		}else{
 
 
 
 
 
 //2
 
$insertSQL="";
	  if(upload("../LandingPage/landingPageFiles/",$_FILES['landingPage_image']['name'],$_FILES['landingPage_image']['tmp_name'])==1){ 

 
//if(move_uploaded_file($_FILES['landingPage_image']['tmp_name'], "../landingPageFiles/" . $_FILES["landingPage_image"]['name'])){


 $filename=time().".".Get_Extension_From_File($_FILES['landingPage_image']['name']);



 rename("../LandingPage/landingPageFiles/".$_FILES['landingPage_image']['name'],"../LandingPage/landingPageFiles/".$filename);

$insertSQL=$insertSQL." , landingPage_image='".$filename."'";



}//4

 
 
 
 
 
 
 
 
 
 

 $landingpage_query="insert into landingpage
set 
landingPage_name='".post($connect,$_REQUEST['landingPage_name'])."'
, landingPage_servicesOperatorID='".post($connect,$_REQUEST['landingPage_servicesOperatorID'])."'
, landingPage_Title='".post($connect,$_REQUEST['landingPage_Title'])."'
, landingPage_introText='".post($connect,$_REQUEST['landingPage_introText'])."'
, landingPage_SubmitMessage='".post($connect,$_REQUEST['landingPage_SubmitMessage'])."'
, SubmitMessage_thankYouMessage='".post($connect,$_REQUEST['SubmitMessage_thankYouMessage'])."'
, SubmitMessage_errorVerificationMEssage='".post($connect,$_REQUEST['SubmitMessage_errorVerificationMEssage'])."'
, SubmitMessage_wrongVerification='".post($connect,$_REQUEST['SubmitMessage_wrongVerification'])."'
, landingPageCode='".generateRandom(7)."'
, landingPageSubmitValue='".post($connect,$_REQUEST['landingPageSubmitValue'])."'
 
, landingPage_BG='".post($connect,$_REQUEST['landingPage_BG'])."'
, landingPage_disclamer='".post($connect,$_REQUEST['landingPage_disclamer'])."'
, landingPage_servicesID='".post($connect,$_REQUEST['landingPage_servicesID'])."'
".$insertSQL."

 ";
 
 
 
 $situation=mysqli_query($connect,$landingpage_query);
 if($situation){ 
 $id=mysqli_insert_id($connect);
 $serviceOerator=$_REQUEST['serviceOper'];
 for($i=0;$i<=sizeof( $serviceOerator);$i++){
	  $situation=mysqli_query($connect,"insert into landingserviceoperator 
set landingServiceOperator_landingid='".$id."'
,landingServiceOperator_serOpID=".$serviceOerator[$i]."");
 
	 
	 }
 
 echo("<div>landingpage Added SucessFully</div>");}
}


go("index.php?page=LandingPage");
}
			
			
			
				 ?>
                
                
                
                   <?php 
				   if($_REQUEST['opt']==add)
				   { 
				   ?>
                   
                   
                   
                   
                   
                   
                  <fieldset>
<legend>Add New Service</legend>      
                   
                   
                   
                   
                   
                   
                   
                       <form method="post" enctype="multipart/form-data"  class="login_form" >
<input type="hidden" name="opt" value="do_add" />
<div class="form-group">
<div class="row ">
<div class="col-md-2">Landing Page Name </div>
<div class="col-md-4"><input type="text" name="landingPage_name" id="landingPage_name" class="form-control" placeholder="Name" /></div>
 
<div class="col-md-2">Landing Page Title </div>
<div class="col-md-4"><input type="text" name="landingPage_Title" id="landingPage_Title" class="form-control" placeholder="Title" /></div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Service Name </div>
<div class="col-md-4"><select name="landingPage_servicesID" id="landingPage_servicesID" class="form-control" data-rel="chosen">
<option value="0">Select Services</option>
<?php $seloperator=mysqli_query($connect,"select * from services");


while($rowProv=mysqli_fetch_array($seloperator)){
	?>
	<option value="<?php echo($rowProv['Services_id']); ?>" <?php if($_REQUEST['ServicesOperator_servicesID']==$rowProv['Services_id']){?> selected<?php } ?>><?php echo($rowProv['Services_name']); ?></option>
	<?php
	
	}
 ?>
</select></div>
 
<div class="col-md-2">Service </div>
<div class="col-md-4" id="ServicesOperator"><?php /* <select name="ServicesOperator" id="ServicesOperator" class="form-control" >
<option value="0">Select Service</option>
 
</select>  */?>

 


</div>
</div>
</div>





 




 



<div class="form-group">
<div class="row ">
<div class="col-md-2">Intro Text  </div>
<div class="col-md-4"><textarea  name="landingPage_introText" id="landingPage_introText"  class="form-control" placeholder="Intro" rows="5" cols="50"></textarea> </div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Submit Message</div>
<div class="col-md-4"><input type="text" name="landingPage_SubmitMessage" id="landingPage_SubmitMessage" class="form-control" placeholder="Submit Message" /></div>
 
<div class="col-md-2">Thank You Message</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_thankYouMessage" id="SubmitMessage_thankYouMessage" class="form-control" placeholder="thank You Message" /></div>
</div>
</div>



<div class="form-group">
<div class="row ">
<div class="col-md-2">Error Verification Message</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_errorVerificationMEssage" id="SubmitMessage_errorVerificationMEssage" class="form-control" placeholder="error Verification Message" /></div>
 
<div class="col-md-2">Wrong Verification</div>
<div class="col-md-4"><input type="text" name="SubmitMessage_wrongVerification" id="SubmitMessage_wrongVerification" class="form-control" placeholder="Wrong Verification" /></div>
</div>
</div>


 

<div class="form-group">
<div class="row ">
<div class="col-md-2">Submit Value</div>
<div class="col-md-4"><input type="text" name="landingPageSubmitValue" id="landingPageSubmitValue" class="form-control" placeholder="Submit Value" /></div>
 
<div class="col-md-2">Image</div>
<div class="col-md-4"><input type="file" name="landingPage_image"></div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">BG Color</div>
<div class="col-md-4"><input type="text" name="landingPage_BG" id="landingPage_BG" class="form-control" placeholder="BG Color" /></div>
</div>
</div>



<div class="form-group">
<div class="row ">
<div class="col-md-2">Disclamer </div>
<div class="col-md-9"><?php 
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor('landingPage_disclamer') ;
$oFCKeditor->BasePath	= $sBasePath ;
$oFCKeditor->Height	= '300' ;
$oFCKeditor->Value		= $post_row['landingPage_disclamer'] ;
$oFCKeditor->Create() ;  ?>
<?php /*?><textarea  name="landingPage_disclamer" id="landingPage_disclamer"  class="form-control" placeholder="Intro" rows="10" cols="50"></textarea><?php */?> </div>
</div>
</div>


<div class="form-group">
<div class="row ">

<div class="col-md-12 center"><input type="submit" name="Add_landingpage" value="Create Page" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>







    </fieldset>












                       <br>
<br>
<br>
<br>






<br>
<br>

 <!-----      end  add landingpage       -->
                       
                       <?php } ?>
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                      
                  <fieldset>
<legend>Search</legend>
                       
                       
                       <form method="post"  class="login_form"  action="index.php?page=LandingPage">
<input type="hidden" name="optsearch" value="1" />
 
<div class="form-group">
<div class="row ">
<div class="col-md-2">Name</div>
<div class="col-md-4"><input type="text" name="landingpage_nameSearch" id="landingpage_nameSearch" class="form-control" placeholder="landingpage_name" value="<?php echo($_REQUEST['landingpage_nameSearch']); ?>" /></div>
 
<div class="col-md-2">operator</div>
<div class="col-md-4">

<select name="ServicesOperator_operatorID" class="form-control" data-rel="chosen">
<option value="0">select operator</option>
<?php $seloperator=mysqli_query($connect,"select * from operator");

while($rowProv=mysqli_fetch_array($seloperator)){
	?>
	<option value="<?php echo($rowProv['Operator_id']); ?>"
    <?php  if($_REQUEST['ServicesOperator_operatorID']==$rowProv['Operator_id']){?> selected<?php } ?>
    ><?php echo($rowProv['Operator_name']); ?></option>
	<?php
	
	}
 ?>
</select>


 
</div>
</div>
</div>


<div class="form-group">
<div class="row ">
<div class="col-md-2">Services </div>
<div class="col-md-4"> 

<select name="ServicesOperator_servicesID" class="form-control" data-rel="chosen">
<option value="0">select Services</option>
<?php $seloperator=mysqli_query($connect,"select * from services");


while($rowProv=mysqli_fetch_array($seloperator)){
	?>
	<option value="<?php echo($rowProv['Services_id']); ?>" <?php if($_REQUEST['ServicesOperator_servicesID']==$rowProv['Services_id']){?> selected<?php } ?>><?php echo($rowProv['Services_name']); ?></option>
	<?php
	
	}
 ?>
</select>


</div>
</div>
</div>
  

<div class="form-group">
<div class="row ">

<div class="col-md-12"><input type="submit" name="update_landingpage" value="Search landingpage" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>
                       
                       
                       
                       
                      
            </fieldset>           
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       <div class="row">
                       <div class="col-md-12">
                         <a href="index.php?page=LandingPage&opt=add" ><i class="glyphicon glyphicon-plus icon-white"></i> Add new landingpage</a><br>

                         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                                         
                         
                         
                           <tr>
                             <td>Service name </td>
                             <td align="center" valign="middle">update </td>
                             <td align="center" valign="middle">Affilates</td>
                             <td align="center" valign="middle">&nbsp;</td>
                           </tr>
                           <?php  
						   
						
			 
			 $query_landingpage="select * from landingpage
 
where 1=1

" ; 
if($_REQUEST['landingpage_nameSearch']!=''){
	$query_landingpage=$query_landingpage." and landingPage_name like '%".$_REQUEST['landingpage_nameSearch']."%'";
	 
	}
	
	
 
		 
			 $landingpage_res=mysqli_query($connect,$query_landingpage);
			
			 if($landingpage_res){
				 while($row=mysqli_fetch_assoc($landingpage_res))
				 {
				
			  ?>
						
                           <tr>
                             <td><?php echo($row['landingPage_name']); ?></td>
                             <td align="center" valign="middle"><a href="index.php?page=LandingPage&opt=up&id=<?php  echo($row['landingPage_id']); ?>"  > 
                              <i class="glyphicon glyphicon-edit icon-white"></i> Update</a>
                              
                              <?php //  <i class="glyphicon glyphicon-trash icon-white"></i> Delete
                               ?>
                               
                               </a>
                              </td>
                             <td align="center" valign="middle"><a href="index.php?page=LandingPageAffilates&Lid=<?php  echo($row['landingPage_id']); ?>"  >Affilates</a></td>
                             <td align="center" valign="middle">&nbsp;</td>
                           </tr>
                           
                           
                           <?php  }}?>
                        
                  </table>
                  <br />


                 
                  </div></div>
                   
                </div>
            </div>
        </div>