Пример #1
0
// Daten aus Datenbank fischen, 3 Spalten in $tabelle stopfen:
$db = mysql_pconnect($sql_server, $sql_user, $sql_password);
mysql_select_db($sql_db, $db);
$result = mysql_query("SELECT * FROM {$sql_table} order by datum", $db);
$max = 0;
while ($myrow = mysql_fetch_row($result)) {
    for ($i = 0; $i < 3; $i++) {
        $tabelle[$max][$i] = $myrow[$i];
    }
    $max++;
}
// Verarbeitung:
// $submit: neuer Eintrag, $export: CSV-Download, wenn nix, dann Darstellung
$reply = "";
if ($export) {
    start_download($tabelle);
} else {
    if ($submit) {
        $db = mysql_pconnect($sql_server, $sql_user, $sql_password);
        if ($db) {
            mysql_select_db($sql_db, $db);
        } else {
            $reply = "kein Connect zur Datenbank bekommen!<br>\n";
        }
        $sql = "INSERT INTO tuxcal (typ,datum,betreff) VALUES ('{$type}','{$date}','{$subject}')";
        $result = mysql_query($sql);
        if ($result) {
            $reply = "Thank you! Information entered.<br>";
            $max = count($tabelle);
            $tabelle[$max][0] = $type;
            $tabelle[$max][1] = $date;
Пример #2
0
            header($protocol . ' ' . $code . ' ' . $text);
            $GLOBALS['http_response_code'] = $code;
        } else {
            $code = isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200;
        }
        return $code;
    }
}
session_start();
$video_id = get_parameter('v');
validate_video_id($video_id);
try {
    if (isset($_SESSION['video'])) {
        if ($_SESSION['video'] == $video_id) {
            if (isset($_GET['dl'])) {
                stream_content();
                exit;
            }
        } else {
            terminate_download();
            start_download();
        }
    } else {
        start_download();
    }
    get_current_status();
} catch (Exception $e) {
    http_response_code(400);
    exit('Caught exception: ' . $e->getMessage() . "\n");
    cleanup();
}