コード例 #1
0
<?php

$ATERR = true;
require './framework.php';
global $html;
if ($html) {
    preMain();
}
// Debug:
// stop('E1', "Nope");
if (isset($_POST['errid']) && isset($_POST['status'])) {
    // Get error data
    $errid = $_POST['errid'];
    $status = $_POST['status'];
    // Use colours when HTML
    if ($html) {
        if (str_starts_with($status, 'OK~ ')) {
            OK();
        } else {
            if (str_starts_with($status, 'D~ ')) {
                D();
            } else {
                if (str_starts_with($status, 'W~ ')) {
                    W();
                } else {
                    if (str_starts_with($status, 'E~ ')) {
                        E();
                    }
                }
            }
        }
コード例 #2
0
<?php

$html = true;
require '../framework.php';
echo preMain();
?>
  <?php 
global $username, $isAdmin, $conn;
function output($txt)
{
    if (is_hash($txt)) {
        $out = '[';
        foreach ($txt as $k => $v) {
            $out .= output($k) . " => " . output($v) . ', ';
        }
        $out .= "]";
        return $out;
    } else {
        if (is_array($txt)) {
            $out = '[';
            foreach ($txt as $k) {
                $out .= output($k) . ', ';
            }
            $out .= "]";
            return $out;
        } else {
            if ($txt === TRUE || $txt === FALSE) {
                return $txt === TRUE ? "true" : "false";
            } else {
                return "'{$txt}'";
            }
コード例 #3
0
            $sql = "UPDATE {$tabl} SET sidip='{$newsessions}' WHERE username='******';";
            $result = $conn->query($sql);
            if ($result === FALSE) {
                stop('E9', "Failed to set new value.");
            }
            stop(0, "Succesfully logged out.");
        } else {
            stop('E10', "Invalid mode.");
        }
    }
}
/*****    Main    *****/
connect();
// global $conn;
if ($html) {
    echo preMain("database.php");
}
// Get given info
if (isset($_GET['username']) && isset($_GET['password']) && isset($_GET['mode'])) {
    $username = $_GET['username'];
    $password = $_GET['password'];
    $mode = $_GET['mode'];
} elseif (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['mode'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $mode = $_POST['mode'];
} else {
    stop('E11', "No or not enough credentials!");
}
// Check username for invalid characters
$chars = str_split($username);