Beispiel #1
0
//include('session.php');
include_once 'controller/user_controller.php';
include_once 'controller/book_controller.php';
include_once 'controller/review_controller.php';
include_once 'controller/read_controller.php';
include_once "searchbook.php";
include_once "approve.php";
include_once "del_book.php";
include_once "del_user.php";
include_once "save_book.php";
include_once "insertbook.php";
$userController = new UserController();
$bookController = new BookController();
$reviewController = new ReviewController();
$readController = new ReadingController();
?>

<!DOCTYPE html>
<html>
	<head>
		<title>E-Biblio. Online library. About</title>
		<meta charset="UTF-8">
		<link rel="stylesheet" href="css/foundation.min.css">
        <link rel="stylesheet" href="css/foundation.css">
		<link rel="stylesheet" href="css/custom.css">
		
		<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,800italic,300italic,400italic,600,600italic,700,700italic,800" rel="stylesheet">
		<link href="https://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700,700italic,900,900italic" rel="stylesheet">
		<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
        
                        </div>
                    </div>
                </div>
                    <div class="row m-t-lg">
                        <div class="col-lg-12">
                            <div>
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="ibox-content">
                                            <div>
                                                <div>
                                                    <span>Readings</span>
                                                    <small class="pull-right">
                                                        <?php 
global $count;
$reading_controller = new ReadingController();
$count = $reading_controller->getCount();
echo $count;
?>
/20000

                                                    </small>
                                                <div class="progress progress-bar-navy-light">
                                                    <div style="width: <?php 
$reading_controller = new ReadingController();
echo $count / 20000 * 100;
?>
%;" class="progress-bar"></div>
                                                </div>
                                            </div>
                                        </div>
<?php

$loc = $_GET['loc'];
$date = $_GET['date'];
include "../LoadClass.php";
$readingController = new ReadingController();
$val1 = $readingController->getOxygenPercentageByLocationDate($loc, $date);
$val2 = $readingController->getNitrogenPercentageByLocationDate($loc, $date);
echo $val1 . ':' . $val2;
<?php

include '../LoadClass.php';
$dbhost = 'localhost';
$dbuser = '******';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
$table_name = "reading";
$backup_file = "reading_dump_" . date("Y-m-d-H-i-s") . ".sql";
$sql = "SELECT * INTO OUTFILE '{$backup_file}' FROM {$table_name}";
mysql_select_db('ozious');
$retval = mysql_query($sql, $conn);
if (!$retval) {
    die('Could not take data backup: ' . mysql_error());
}
$readingController = new ReadingController();
$readingController->delete();
$backup = new Backup($backup_file, "Ozious");
$backupController = new BackupController();
$backupController->insert($backup);
echo "Backedup  data successfully\n";
mysql_close($conn);
</head>

<body class="gray-bg">


    <div class="middle-box text-center animated fadeInDown">

        <h3 class="font-bold">Sensor Data Generator</h3>
        <div class="error-desc">
            This page generates sensor readings
            <?php 
$index = 8;
$value1 = 30;
$value2 = 35;
$readingController = new ReadingController();
while (true) {
    sleep(10);
    if ($index == 8) {
        $index = 9;
    } elseif ($index == 9) {
        $index = 10;
    } else {
        $index = 8;
    }
    $reading_object = new Reading(0, $index, date("Y-m-d"), date("h:i:sa"), rand($value1, $value2));
    $readingController->insert($reading_object);
}
?>

        </div>
<?php

include "../LoadClass.php";
$loc = $_GET['loc'];
$date = $_GET['date'];
$readingController = new ReadingController();
$readingController = new ReadingController();
$read = $readingController->getHumidityPercentageByLocationDate($loc, "2016-01-01");
$val = $readingController->getTemperatureByLocationDateToArray($loc, $date);
echo $read->getValue() . '-' . $val;
<?php

header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
echo '<response>';
$value = $_GET['randvalue'];
echo $value;
include "LoadClass.php";
$readingController = new ReadingController();
$reading = new Reading(0, 8, date("Y-m-d"), date("h:i:sa"), $value);
$readingController->insert($reading);
echo '</response>';
?>