
<?php
//this page brings out a static form editing ip


if($_POST['act'] == 'edit_ips')
{
	  $id_array = $_POST['ip']; // return array
	  $id_count = count($_POST['ip']); // count array
	  
	
	  
?>


<div class="well">

      <ul class="tabs"> 
        <li><a href="#view1" >IP Details</a></li> 
      </ul> 
      <div class="tabcontents"> 
        <div id="view1"  class="row">
        

        <?php 
		
		for($i=0; $i < $id_count; $i++) 
		{
		  $id = $id_array[$i];
		  $q = "SELECT * FROM ip_filter WHERE id = '$id'";
		  $r = mysqli_query(dbc(),$q);
				
		  if(!$r) { die(mysql_error()); }
		
			  
			  if(mysqli_num_rows($r) > 0)
			  {//begin if result exist
				  while($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
				  {//begin while
		?>
        
        
        			 <!-- form cut to the toolbar  -->
              		<div class="col-lg-12">
              
                  		<div class="col-lg-6">
              
               
                  
                          <fieldset> 
                              <legend><span class="ast">*</span> indicate required fields </legend>
        
  
                             
                             
                                                         
                            <div class="form-group">
                                  <label for="title" class="col-sm-3 control-label">Title </label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="title" class="form-control input-sm" type="text" placeholder="Title"  name="title" 
                                    value="<?php if(isset($row['title'])) echo $row['title']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                     
                                  </div>
                               </div>  
                               
                                                      
                             <div class="form-group">
                                  <label for="ips" class="col-sm-3 control-label">IP</label>
                                  <div class="col-sm-9">
                                    <div class="input-group">
                                    <input  id="ips" class="form-control input-sm" type="text" placeholder="Insert the Ip"  name="ips" 
                                    value="<?php if(isset($row['ips'])) echo $row['ips']; ?>" required></input>
                                    <div class="input-group-addon"> <span class="ast">*</span></div>
                                    </div>
                                       <span class="help-block"> e.g: 1922348043. </span>
                                  </div>
                               </div>
                             
                              
                             
                             
                           <div class="form-group">
                            <label class="col-sm-3 control-label" for="description">Note / Description</label>
                              <div class="col-sm-9">
                              
                                <textarea  id="" rows="3" class="rte1 form-control input-sm" name="description" action="#" >
                                <?php if(isset($row['description'])){echo $row['description'];} ?>
                                </textarea>
                              </div>
                            </div>
                            
                         
                           <div class="form-group">
                                <label class="col-sm-3 control-label" for="user_status">System Status</label>
                                <div class="col-sm-9">
                                
                                      <select  class="form-control input-sm" name="system_status"  id="system_status" required>
                                       <option value="1"  selected> Unblock </option>
                                       <option value="0" <?php if($row['activate']=='0') echo "selected";?>> Block </option>
                                      </select>
                                     <!-- <div class="input-group-addon"> <span class="ast">*</span></div>-->
                                 
                                </div>
                           </div>
                          
                                     
                           <div class="form-group">
                            <label class="col-sm-3 control-label" for="gender">Status</label>
                            <div class="col-sm-9">
                            
                              <select id="status" class="form-control input-sm" name="status" required>
                                
                              <?php  echo select_status($row['status']); ?>
                                
                               </select>
                            
                               
                            </div>
                            
                          </div>	
                         
             
                  
                  
                  
                        <input type="hidden" value="update_ips" name="act" />
                        <input type="hidden" value="TRUE" name="update_ips" /><!-- pass value for editing -->
                        <input type="hidden" value="<?php echo $row['id']; ?>" name="ip" id='ip' /><!-- pass id value incase he didnt fill well den bring bk for editing -->
                    
  
              </div><!-- /col-lg- 6 -->
                  </fieldset>
              
                  </form>
                
                
               
			</div><!-- / col-lg -12 -->
        

	<?php
				  }//end of if
				  }//end of while
	
			  }//end of for loop
	?>

        
        </div>  <!-- #view1 -->
         
      </div> <!-- /tab-content -->
</div> <!-- /well-->
<?php 

}//end of if post edit user
?>
