<?php include("includes/header.php");

	require("includes/function.php");
	require("language/language.php");
	 
	
	$qry="SELECT * FROM tbl_settings where id='1'";
  $result=mysqli_query($mysqli,$qry);
  $settings_row=mysqli_fetch_assoc($result);

 

  if(isset($_POST['submit']))
  {

    

    $img_res=mysqli_query($mysqli,"SELECT * FROM tbl_settings WHERE id='1'");
    $img_row=mysqli_fetch_assoc($img_res);
    

    if($_FILES['live_url']!="")
    {        
              $data = array(      
              'video_type'  =>  $_POST['video_type'],
              'live_url'  =>  $_POST['live_url'], 
              'facebook'  =>  $_POST['facebook'], 
              'twitter'  =>  $_POST['twitter'], 
              'instagram'  =>  $_POST['instagram'], 
              'youtube'  =>  $_POST['youtube'], 
              'company'  =>  $_POST['company'], 
              'email'  =>  $_POST['email'], 
              'website'  =>  $_POST['website'], 
              'contact'  =>  $_POST['contact'],
              'package_name'  =>  $_POST['package_name'],
              'description'  =>  $_POST['description']                       
              );

    }
    else
    {
                $data = array(
                
                    'video_type'  =>  $_POST['video_type'],
                    'live_url'  =>  $_POST['live_url'], 
                    'facebook'  =>  $_POST['facebook'], 
                    'twitter'  =>  $_POST['twitter'], 
                    'instagram'  =>  $_POST['instagram'], 
                    'youtube'  =>  $_POST['youtube'], 
                    'company'  =>  $_POST['company'], 
                    'email'  =>  $_POST['email'], 
                    'website'  =>  $_POST['website'], 
                    'contact'  =>  $_POST['contact'],
                    'package_name'  =>  $_POST['package_name'],
                    'description'  =>  $_POST['description']                       
                
                  );

    } 

    $settings_edit=Update('tbl_settings', $data, "WHERE id = '1'");
 

      if ($settings_edit > 0)
      {

        $_SESSION['msg']="11";
        header( "Location:settings_app.php");
        exit;

      }   
 
  }



?>

	 <div class="row">
      <div class="col-md-12">
        <div class="card">
		  <div class="page_title_block">
      <div class="page_title">Settings App</div>
          <div class="row mrg-top">
            <div class="col-md-12">
               
              <div class="col-md-12 col-sm-12">
                <?php if(isset($_SESSION['msg'])){?> 
                 <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                  <?php echo $client_lang[$_SESSION['msg']] ; ?></a> </div>
                <?php unset($_SESSION['msg']);}?> 
              </div>
            </div>
          </div>
          <div class="card-body mrg_bottom">
            <!-- Nav tabs -->
            
          
           <div class="tab-content">
              
              <div role="tabpanel" class="tab-pane active" id="app_settings">	  
                <form action="" name="settings_from" method="post" class="form form-horizontal" enctype="multipart/form-data">
              <div class="section">
                <div class="section-body">


                <div class="form-group">
                    <label class="col-md-3 control-label">Video Type
                  
                    </label>
                    <div class="col-md-6">
                    <select name="video_type" id="video_type" class="select2">
                        <option value="m3u8" <?php if($settings_row['video_type']=="m3u8"){?>selected<?php }?>>Live m3u8</option>
                        <option value="youtube" <?php if($settings_row['video_type']=="youtube"){?>selected<?php }?>>Live YouTube</option>
                      </select>


                
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label class="col-md-3 control-label">Live Url</label>
                    <div class="col-md-6">
                      <input type="text" name="live_url" id="live_url" value="<?php echo $settings_row['live_url'];?>" class="form-control">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-3 control-label">Nombre de Paquete de APP</label>
                    <div class="col-md-6">
                      <input type="text" name="package_name" id="package_name" value="<?php echo $settings_row['package_name'];?>" class="form-control">
                    </div>
                  </div>
                  

                  </br>
                  </br>
                  </br>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Facebook</label>
                    <div class="col-md-6">
                      <input type="text" name="facebook" id="facebook" value="<?php echo $settings_row['facebook'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Twitter</label>
                    <div class="col-md-6">
                      <input type="text" name="twitter" id="twitter" value="<?php echo $settings_row['twitter'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Instagram</label>
                    <div class="col-md-6">
                      <input type="text" name="instagram" id="instagram" value="<?php echo $settings_row['instagram'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Youtube</label>
                    <div class="col-md-6">
                      <input type="text" name="youtube" id="youtube" value="<?php echo $settings_row['youtube'];?>" class="form-control">
                    </div>
                  </div>

                  </br>
                  </br>
                  </br>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Company</label>
                    <div class="col-md-6">
                      <input type="text" name="company" id="company" value="<?php echo $settings_row['company'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Email</label>
                    <div class="col-md-6">
                      <input type="text" name="email" id="email" value="<?php echo $settings_row['email'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Website</label>
                    <div class="col-md-6">
                      <input type="text" name="website" id="website" value="<?php echo $settings_row['website'];?>" class="form-control">
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Contact</label>
                    <div class="col-md-6">
                      <input type="text" name="contact" id="contact" value="<?php echo $settings_row['contact'];?>" class="form-control">
                    </div>
                  </div>

                  <Style>
                  textarea {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 18px;
    background-clip: padding-box;
    background: white;
    border: 1px solid #c8d1d3;
    background-color: #f8f9fa;
    border-radius: 5px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #7e7e7e;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    height: 150px;
    margin: 0;
    outline: 0;
    width: 100%;
    padding: 10px;
}textarea {
    overflow: auto;
}
.horizontal-form .inputs, .horizontal-form--wide .inputs {
    float: left;
    position: relative;
    width: 78.68852%;
}
                  </Style>

                  <div class="form-group">
                    <label class="col-md-3 control-label">Description</label>
                    <div class="col-md-6">


                    
                    
                      <div class="inputs"><textarea name="description" id="description" ><?php echo $settings_row['description'];?></textarea></div>
                   
                  </div>
                  <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                      <button type="submit" name="submit" class="btn btn-primary">Save</button>
                    </div>
                  </div>
                </div>
              </div>
               </form>
              </div>
            </div>   

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

        
<?php include("includes/footer.php");?>       
