예제 #1
0
*/
DEFINE("ADMINLEVELNEEDED", 'AddTemp');
include_once "include_files/access.inc.php";
$db = new mysqli($db_server, $db_username, $db_password, $db_name);
$temps = FALSE;
$station = FALSE;
$user = FALSE;
$temps = FALSE;
$unit = FALSE;
$inserts = array();
$station = Is_Set_Request('Station', $db);
$user = $_SESSION['USER'];
if (isset($_REQUEST['temp']) && !empty($_REQUEST['temp'])) {
    $temps = $_REQUEST['temp'];
}
if (Check_Admin_String('ChangeUnit', $_SESSION['ADMINLEVEL'])) {
    $unit = Is_Set_Request('Unit', $db);
} else {
    $unit = $_SESSION['UNIT'];
}
if ($station != FALSE && $user != FALSE && $unit != FALSE && $temps != FALSE) {
    foreach ($temps as $item => $temp) {
        if (is_numeric($item)) {
            $item = $db->real_escape_string($item);
        } else {
            $item = FALSE;
        }
        if (is_numeric($temp)) {
            $temp = $db->real_escape_string($temp);
        } else {
            $temp = FALSE;
예제 #2
0
function Is_Set_Request($request, $db)
{
    /* check if server is alive */
    if ($db->ping()) {
        /* escape request string */
        if (isset($_REQUEST[$request]) && !empty($_REQUEST[$request])) {
            return $db->real_escape_string($_REQUEST[$request]);
        } else {
            if (DEBUG) {
                echo "ERROR: Is Set Request error 1";
            }
            return FALSE;
        }
    } else {
        echo "ERROR: Is Set Request error 2";
        return FALSE;
    }
}
if (!isset($_SESSION['USER'])) {
    //check to see if the user is logged in and if not redirect.
    header('Location: index.php');
    exit;
} elseif (empty($_SESSION['USER'])) {
    //Doublecheck to see if the user is logged in and if not redirect.
    header('Location: index.php');
    exit;
} elseif (!Check_Admin_String(ADMINLEVELNEEDED, $_SESSION['ADMINLEVEL'])) {
    //Check to see if the user is authorised to see the page
    header('Location: index.php');
    exit;
}