
 <div>
    <ul class="breadcrumb">
        <li>
            <a href="index.php">Home</a>
        </li>
        <li>
            <a href="index.php?page=Subscribers"> Add Subscribers</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> Subscribers</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){
					 
			$selectQuery=mysqli_query($connect,"select * from Subscribers
			where Subscribers_id='".post($connect,$_REQUEST['id'])."' ");
			$rowQuery=mysql_fetch_array($selectQuery);
			
			$status=0;
 if($rowQuery['Subscribers_status']==0){
	 $status=1;
	 }
 

 $Subscribers_query="update Subscribers
set 
 Subscribers_status='".$status."'
 where Subscribers_id='".post($connect,$_REQUEST['id'])."'
 
 
 
 ";
 
 
 
 $situation=mysqli_query($connect,$Subscribers_query);
 if($situation){ echo("<div>Subscribers Updated SucessFully</div>");}
} 
				 ?>
                 
                 
                
                 
                 
                 
                
                  
                
                <?php 
				
			if($_REQUEST['opt']==do_add)
{
	
	if($_REQUEST['mobileNumber']==''
	
	){
		
		echo("<div style='color:red'> Please Fill All Parameters </div>");
		}else{
 
 
 
 $selNuber=mysqli_query($connect,"select * from Subscribers
where Subscribers_phone='".post($connect,$_REQUEST['mobileNumber'])."'
and 
 ");
 
 if(mysql_num_rows($selNuber)!=0){echo("<div>Subscribers Already Found</div>");}else{
 

 $Subscribers_query="insert into Subscribers
set 
 Subscribers_phone='".post($connect,$_REQUEST['mobileNumber'])."'
 ,Subscribers_regDate=now()
,Subscribers_renewDate=now()
,Subscribers_Statusid=1
,Subscribers_servicesID='".$_SESSION['serviceID']."'
,Subscribers_providerid='".$_SESSION['provider']."'

";
 
 
 
 $situation=mysqli_query($connect,$Subscribers_query);
 
 
 
 
 
 
 
 
 if($situation){ echo("<div>Subscribers Added SucessFully</div>");}
 
 }
 
 
}}
			
			
			
				 ?>
                
                
                
                   <?php 
				   if($_REQUEST['opt']==add)
				   { 
				   ?>
                       <form method="post"  class="login_form" >
<input type="hidden" name="opt" value="do_add" />



<div class="form-group">
<div class="row ">
<div class="col-md-5">Mobile number</div>
<div class="col-md-4"><input type="text" name="mobileNumber" id="mobileNumber" class="form-control" placeholder="Subscribers mobile" /></div>
</div>
</div>

 
 


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

<div class="col-md-12"><input type="submit" name="Add_Subscribers" value="Add Subscribers" class="action-button"  style="width:120px"/></div>
</div>
</div>

</form>
<br>
<br>

 <!-----      end  add Subscribers       -->
                       
                       <?php } ?>
                       
                       
                       
                       
                       
                        
                   
                       <form method="post"  class="login_form" >
<input type="hidden" name="opt" value="do_search" />



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

<div class="col-md-2">Mobile number</div>
<div class="col-md-4"><input type="text" name="mobileNumber" id="mobileNumber" class="form-control" placeholder="Subscribers mobile" /></div>

<div class="col-md-2">Services</div>
<div class="col-md-4"><input type="text" name="mobileNumber" id="mobileNumber" class="form-control" placeholder="Subscribers mobile" /></div>

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

<div class="row ">
<div class="col-md-2">Services Operator</div>
<div class="col-md-4"><input type="text" name="mobileNumber" id="mobileNumber" class="form-control" placeholder="Subscribers mobile" /></div>
</div>
</div>

 
 


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

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

</form>
<br>
<br>

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

                         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                                         
                         
                         
                           <tr>
                             <td>Mobile </td>
                             <td>Reg  Date</td>
                             <td align="center" valign="middle">Renew Date</td>
                             <td align="center" valign="middle">Finish Date</td>
                             <td align="center" valign="middle">Service</td>
                             <td align="center" valign="middle">Service Operator</td>
                             <td align="center" valign="middle">Status</td>
                             <td align="center" valign="middle">Messages</td>
                             <td align="center" valign="middle">History</td>
                             <td align="center" valign="middle"> Phantom</td>
                             <td align="center" valign="middle">update </td>
                           </tr>
                           <?php  
						   
						
			 
			 $query_Subscribers="select * from Subscribers inner join 
substatus on subStatus_codeID=Subscribers_status
		inner join servicesoperator on ServicesOperator_id=Subscribers_serviceoperator
inner join services on Services_id=ServicesOperator_servicesID	 
  
	 " ;
		 
			 $Subscribers_res=mysqli_query($connect,$query_Subscribers);
			
			 if($Subscribers_res){
				 while($row=mysqli_fetch_assoc($Subscribers_res))
				 {
				
			  ?>
						
                           <tr>
                             <td><?php echo($row['Subscribers_phone']); ?></td>
                             <td><?php echo($row['Subscribers_regData']); ?></td>
                             <td align="center" valign="middle"><?php echo($row['Subscribers_renewDate']); ?></td>
                             <td align="center" valign="middle">
                             <?php echo($row['Subscribers_finishDate']); ?>
                             
                              </td>
                             <td align="center" valign="middle">
                             
                              <?php echo($row['Services_name']);
							  ?>
                             
                             </td>
                             <td align="center" valign="middle"><?php echo($row['ServicesOperator_name']);
							  ?></td>
                             <td align="center" valign="middle">
                             <?php echo($row['subStatus_name']);
							  ?>
                             
                             </td>
                             <td align="center" valign="middle"><a href="index.php?page=Subscribers&opt=do_up&id=<?php  echo($row['Subscribers_id']); ?>"  ><i class="glyphicon glyphicon-edit icon-white"></i>  Messages</a></td>
                             <td align="center" valign="middle">   <a href="index.php?page=Subscribers&opt=do_up&id=<?php  echo($row['Subscribers_id']); ?>"  ><i class="glyphicon glyphicon-edit icon-white"></i>  History</a></td>
                             <td align="center" valign="middle">   <a href="index.php?page=Subscribers&opt=do_up&id=<?php  echo($row['Subscribers_id']); ?>"  ><i class="glyphicon glyphicon-edit icon-white"></i>  Phantom</a></td>
                             <td align="center" valign="middle">
                             
                             
                             
                             
                             
                             <a href="index.php?page=Subscribers&opt=do_up&id=<?php  echo($row['Subscribers_id']); ?>"  ><i class="glyphicon glyphicon-edit icon-white"></i> Update </a>
                              
                              
                               
                           
                               
                               
                               
                               
                               
                              </td>
                           </tr>
                           
                           
                           <?php  }}?>
                        
                  </table>
                  <br />


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