コード例 #1
0
ファイル: index.php プロジェクト: 0xTHR34T/AIContestPlatform
<?php

require "../../Core/bTerminal/main.php";
use Core\bTerminal\Main\Main as main;
use Core\bTerminal\Main\Contest as contest;
//use Core\bTerminal\Supports;
$obj = new main();
$obj2 = new contest();
$valid = $obj->validate($_COOKIE["AICP_UserName"], $_COOKIE["AICP_PassWord"]);
if (!isset($_COOKIE["AICP_UserName"]) || !$valid) {
    echo "Redirecting...";
    header("Location: ../");
}
?>
<!DOCTYPE html>
<html lang = "en">
<head>
    <meta charset = "utf-8">
    <meta name = "viewport" content = "width=device-width , initial-scale=1">
    <link rel = "stylesheet" href = "../bootstrap-3.3.5/css/bootstrap.min.css">
    <link rel = "stylesheet" href = "css/main.css">
    <script src = "js/jquery-1.11.3.min.js"></script>
    <script src = "js/jquery.color-2.1.2.min.js"></script>
    <script src = "../bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src = "js/angular.min.js"></script>
    <script src = "js/jMain.js"></script>
    <script src = "js/alt.js"></script>
    <script src = "js/userconn.js"></script>
    <title><?php 
echo $_COOKIE["AICP_UserName"] . " > " . "AICP Panel";
?>
コード例 #2
0
<?php

require "../../Core/bTerminal/main.php";
use Core\bTerminal\Main\Main as main;
use Core\bTerminal\Main\Contest as contest;
$main = new main();
$contest = new contest();
if (!isset($_COOKIE["AICP_UserName"]) || !isset($_COOKIE["AICP_PassWord"]) || !isset($_GET["query"])) {
    die("FORBIDDEN");
}
if (!$main->validate($_COOKIE["AICP_UserName"], $_COOKIE["AICP_PassWord"])) {
    die("Invalid username or password");
}
if ($_GET["query"] == "show") {
    die($contest->fetchContests());
} else {
    if ($_GET["query"] == "create") {
        if (!isset($_GET["number"]) || !isset($_GET["agent"])) {
            die("Invalid command");
        }
        if ($contest->createContest($_COOKIE["AICP_UserName"], $_GET["number"], $_GET["agent"])) {
            die("Created!");
        }
        die("Failed!");
    } else {
        if ($_GET["query"] == "join") {
            if (!isset($_GET["agent"])) {
                die("No agent specified");
            } else {
                if (!isset($_GET["contest"])) {
                    die("No contest specified");
コード例 #3
0
ファイル: login.php プロジェクト: 0xTHR34T/AIContestPlatform
<?php

require_once "../Core/bTerminal/main.php";
use Core\bTerminal\Main\Main as main;
$obj = new main();
$usr = $_GET["userName"];
$pss = $_GET["Password"];
$chb = $_GET["rem"];
$valid = $obj->validate($usr, $pss);
if ($chb) {
    // it doesn't work!
    $expire = time() + 86400;
} else {
    $expire = 0;
}
if (!$valid) {
    die("Incorrect username or password");
} else {
    setcookie("AICP_UserName", $usr, $expire);
    setcookie("AICP_PassWord", $pss, $expire);
    echo "Redirecting to your panel...";
    header("Location: UserPanel/");
}