コード例 #1
0
ファイル: table.php プロジェクト: Jaanmk/3.kodutoo-I-ruhm
<?php

$page_title = "User edit";
$page_file_name = "userpage.php";
require_once __DIR__ . "/functions.php";
require_once __DIR__ . "/user_manage_class.php";
if (is_null($_SESSION['logged_in_uid'])) {
    session_destroy();
    header("Location: index.php");
}
$user_manage = new user_manage($connection);
$userfirstname_error = "";
$userlastname_error = "";
$useraddress_error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["userfirstname"])) {
        $userfirstname_error = "FirstName is required";
    } else {
        $userfirstname = test_input($_POST["userfirstname"]);
    }
    if (empty($_POST["userlastname"])) {
        $userlastname_error = "LastName is required";
    } else {
        $userlastname = test_input($_POST["userlastname"]);
    }
    if (empty($_POST["useraddress"])) {
        $useraddress_error = "Address required";
    } else {
        $useraddress = test_input($_POST["useraddress"]);
    }
    if ($userfirstname_error == "" and $userlastname_error == "" and $useraddress_error == "") {
コード例 #2
0
ファイル: table2.php プロジェクト: Jaanmk/Veebiproge_eksam
<?php

/**
 * Created by PhpStorm.
 * User: JaanMartin
 * Date: 12.01.2016
 * Time: 18:13
 */
require_once __DIR__ . '/../functions.php';
require_once __DIR__ . '/../user_manage_class.php';
$user_manage = new user_manage($connection);
$users_array = $user_manage->getAllUsers();
if (isset($_GET["delete"])) {
    $response = $user_manage->deleteUsers($_GET["delete"]);
}
if (isset($_GET["update"])) {
    $response = $user_manage->updateUsers($_GET['first_name'], $_GET['last_name'], $_GET['phone'], $_GET['user_id'], $_GET['badge']);
}
$keyword = "";
if (isset($_GET["keyword"])) {
    $keyword = $_GET["keyword"];
    $users_array = $user_manage->getAllUsers($keyword);
} else {
    $users_array = $user_manage->getAllUsers();
}
require_once __DIR__ . '/header.php';
?>

<body>
<table class="table table-hover">
    <tr>
コード例 #3
0
ファイル: index.php プロジェクト: Jaanmk/3.kodutoo-I-ruhm
<?php

/**
 * Created by PhpStorm.
 * User: JaanMartin
 * Date: 12.01.2016
 * Time: 10:11
 */
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/user_manage_class.php';
$user_manage = new user_manage($connection);
$username_error = $pw_error = $usernamecreate_error = $passwordcreate_error = "";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (empty($_POST["loginusername"])) {
        $username_error = "Username is required";
    } else {
        //echo "kasutajanimi db";
        $username_to_db = clean_input($_POST["loginusername"]);
    }
    if (empty($_POST["loginpassword"])) {
        $pw_error = "Password is required";
    } else {
        //echo "pass db";
        $loginpassword = clean_input($_POST['loginpassword']);
        $password_to_db = hash(sha512, $loginpassword);
    }
    if (empty($_POST["createusername"])) {
        $usernamecreate_error = "Username is required";
    } else {
        $createusername = clean_input($_POST["createusername"]);
        //  echo"create kasutajanimi korras";
コード例 #4
0
ファイル: table.php プロジェクト: Jaanmk/Veebiproge_eksam
<?php

$page_title = "User edit";
$page_file_name = "userpage.php";
require_once __DIR__ . "/functions.php";
require_once __DIR__ . "/user_manage_class.php";
if (is_null($_SESSION['logged_in_uid'])) {
    session_destroy();
    header("Location: index.php");
}
$user_manage = new user_manage($connection);
$userfirstname_error = "";
$userlastname_error = "";
$useraddress_error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["first_name"])) {
        $userfirstname_error = "FirstName is required";
    } else {
        $first_name = test_input($_POST["first_name"]);
    }
    if (empty($_POST["last_name"])) {
        $userlastname_error = "LastName is required";
    } else {
        $last_name = test_input($_POST["last_name"]);
    }
    if (empty($_POST["userphone"])) {
        $userphone_error = "Address required";
    } else {
        $phone = test_input($_POST["userphone"]);
    }
    if (empty($_POST["tag"])) {
コード例 #5
0
ファイル: arduinput.php プロジェクト: Jaanmk/Veebiproge_eksam
<?php

/**
 * Created by PhpStorm.
 * User: JaanMartin
 * Date: 13.01.2016
 * Time: 15:11
 */
require_once __DIR__ . '/../functions.php';
require_once __DIR__ . '/../user_manage_class.php';
$user_manage = new user_manage($connection);
if (isset($_GET["temperatuur"]) && isset($_GET["andur"])) {
    $response = $user_manage->arduinput($_GET['temperatuur'], $_GET['andur']);
} else {
}
if (isset($response->success)) {
    ?>

    <p><?php 
    echo $response->success->message;
    ?>
</p>

<?php 
} elseif (isset($response->error)) {
    ?>

    <p><?php 
    echo $response->error->message;
    ?>
</p>
コード例 #6
0
ファイル: new_user.php プロジェクト: Jaanmk/1.kodutoo-I-ruhm
<?php

$page_title = "User edit";
$page_file_name = "userpage.php";
require_once __DIR__ . "/functions.php";
require_once __DIR__ . "/user_manage_class.php";
if (is_null($_SESSION['logged_in_uid'])) {
    session_destroy();
    header("Location:index.php");
}
$user_manage = new user_manage($connection);
$userfirstname_error = "";
$userlastname_error = "";
$useraddress_error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["userfirstname"])) {
        $userfirstname_error = "FirstName is required";
    } else {
        $userfirstname = test_input($_POST["userfirstname"]);
    }
    if (empty($_POST["userlastname"])) {
        $userlastname_error = "LastName is required";
    } else {
        $userlastname = test_input($_POST["userlastname"]);
    }
    if (empty($_POST["useraddress"])) {
        $useraddress_error = "Address required";
    } else {
        $useraddress = test_input($_POST["useraddress"]);
    }
    if ($userfirstname_error == "" and $userlastname_error == "" and $useraddress_error == "") {
コード例 #7
0
ファイル: kaart1.php プロジェクト: Jaanmk/Veebiproge_eksam
<?php

/**
 * Created by PhpStorm.
 * User: JaanMartin
 * Date: 14.01.2016
 * Time: 11:40
 */
require_once __DIR__ . '/../functions.php';
require_once __DIR__ . '/../user_manage_class.php';
$user_manage = new user_manage($connection);
$temp_array = $user_manage->gettemp1();
?>
<html>
<head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
        google.charts.load('current', {'packages':['corechart']});
        google.charts.setOnLoadCallback(drawChart);

        function drawChart() {
            var data = google.visualization.arrayToDataTable([
                ['Aeg', 'Temp1'],
                <?php 
for ($i = 0; $i < count($temp_array); $i++) {
    $my_sql_date = $temp_array[$i]->time;
    $date_time = new DateTime($my_sql_date);
    echo "[new Date(";
    echo $date_time->format('Y');
    echo ",";
    echo intval($date_time->format('m')) - 1;