예제 #1
0
function addNewMatchGallery()
{
    if (!isset($_SESSION['username']) || !isset($_SESSION['admin_password'])) {
        header("index.html");
    }
    $galleryname = $_REQUEST['galleryname'];
    $match_date = date($_REQUEST['match_date']);
    $description = $_REQUEST['description'];
    $picture = $_REQUEST['picture'];
    include "../../model/matchgallery.php";
    $matchgallery = new Matchgallery();
    if (!$matchgallery->addMatchgallery($galleryname, $match_date, $description, $picture)) {
        echo '{"result": 0, "message": "Could not add new match gallery, try again"}';
        return;
    }
    echo '{"result": 0, "message": "' . $galleryname . ' has been added"}';
    return;
}
예제 #2
0
function MatchGallery()
{
    include_once "../model/matchgallery.php";
    $gallery = new Matchgallery();
    $row = $gallery->getGalleries();
    if (!$row) {
        echo '{"result": 0, "message": "No Match gallery yet"}';
        return;
    }
    echo '{"result": 1, "galleries": [';
    while ($row) {
        echo json_encode($row);
        $row = $gallery->fetch();
        if ($row) {
            echo ",";
        }
    }
    echo "]}";
    return;
}