<?php




include('db_con.php');




  include('header.php');




  include('function.php');




  




  if (isset($_SESSION['user_id'])) {




    $user_type = $_SESSION['user_type'];




    $user_id = $_SESSION['user_id'];




    $user_name = $_SESSION['user_name'];




    $branch_id = $_SESSION['branch_id'];




    $branch_name = $_SESSION['branch_name'];




    $store_id = $_SESSION['store_id'];




    $store_name = $_SESSION['store_name'];




}else{




  header('Location: login');




  die();




}









 









            $sql = "SELECT app_status FROM app_settings WHERE app_name = 'server_value'";




            $statement = $connect->prepare($sql);




            $statement->execute(); // no need to add `$sql` here, you can take that out




            $server_value = $statement->fetchColumn();



















if(isset($_POST["save"]))




{









$server_value= $_POST["server_value"];









$statement = $connect->prepare("




        UPDATE app_settings




        SET app_status = :app_status       




        WHERE app_name = :app_name




      ");









      $statement->execute(




        array(         




          ':app_status'             =>  $server_value,          




          ':app_name'               =>  'server_value'




        )




      );




      header("location:dashboard.php");




}




?>




<!DOCTYPE html>




<html lang="en">




  <head>




    <title></title>




    




    <style>




      /* Remove the navbar's default margin-bottom and rounded borders */ 




      .navbar {




      margin-bottom: 4px;




      border-radius: 0;




      }




      /* Add a gray background color and some padding to the footer */




      footer {




      background-color: #f2f2f2;




      padding: 25px;




      }




      .carousel-inner img {




      width: 100%; /* Set width to 100% */




      margin: auto;




      min-height:200px;




      }




      




      .navbar-brand:hover




      {




      background-color:#ffffff;




      }




      /* Hide the carousel text when the screen is less than 600 pixels wide */




      @media (max-width: 600px) {




      .carousel-caption {




      display: none; 




      }




      }




    </style>




     









    <title>Server Settings</title>









    <!-- Bootstrap Core CSS -->




   




  </head>




  <body>




    <style>




      .box




      {




      width: 100%;




      max-width: 1390px;




      border-radius: 5px;




      border:1px solid #ccc;




      padding: 15px;




      margin: 0 auto;                




      margin-top:50px;




      box-sizing:border-box;




      }




    </style>




    <link rel="stylesheet" href="css/datepicker.css">




    <script src="js/bootstrap-datepicker1.js"></script>




    <link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">




    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" />




    <script>




      $(document).ready(function(){




        $('#dated').datepicker({




          format: "yyyy-mm-dd",




          autoclose: true




        });




      });




    </script>




    <div class="container-fluid">




<?php include('top-pannel.php');?>




       <form method="post" id="setting_form" AutoComplete="off" />




        <div class="table-responsive">




          <table class="table table-bordered">









           <tr>




           <td width="50%"><h4>Turn Off Software</h4></td><td>




           <input type="radio" name="server_value" id="server_value" class="radio-inline server_value"




           value="ON"  <?php if($server_value=='ON'){echo "checked";}?> />ON




           <input type="radio" name="server_value" id="server_value" class="radio-inline server_value" 




           value="OFF" <?php if($server_value=='OFF'){echo "checked";}?> />OFF</td>




                        <br />




          </tr>









          <tr>




                <td colspan="2" align="center">




                  




                  <input type="submit" name="save" id="save" class="btn btn-info" value="Save" />




                </td>




              </tr>




          </table>









        </div>




       </form>