Example #1
0
<?php

header('Content-type: application/json');
require_once './config.php';
require_once '../socket.php';
error_reporting(E_ERROR | E_PARSE);
// If result matched $username and $password, table row  must be 1 row
if ($count == 1) {
    $mode = $_GET['mode'];
    if ($mode == "Normal") {
        $status = 1;
    } else {
        $status = 2;
    }
    $socket = initialize_socket();
    $result = set_system_status($socket, $status);
    close_socket($socket);
    $sql = "UPDATE device SET value='{$mode}' WHERE attr='mode'";
    if (mysqli_query($con, $sql)) {
        echo "success";
        $log = "System mode set to " . $mode . " by " . $username . " from Mobile";
        $sql = "INSERT INTO logs (log) VALUES('{$log}')";
        mysqli_query($con, $sql);
    } else {
        echo "Error updating record: " . mysqli_error($con);
    }
} else {
    echo "Invalid";
}
Example #2
0
<body>

   

        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <?php 
get_header();
?>
            
        </nav>
                <div class="alert alert-danger">
                    Ouch!!! BeagleBone Black Server is either not connected in the network or not responding in timely manner.
                <?php 
echo initialize_socket();
?>
                </div>
        

    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="js/plugins/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="js/sb-admin-2.js"></script>