Example #1
0
<?php

require_once '../init.php';
for ($i = 0; $i <= 10; ++$i) {
    RedisQ\RedisQ::queueObject($i);
}
Example #2
0
<?php

require_once '../init.php';
$queueID = @$_POST['queueID'];
if ($queueID === null) {
    $queueID = RedisQ\IP::get();
}
$package = unserialize(RedisQ\RedisQ::listen($queueID));
if ($package === false) {
    $package = null;
}
$response = ['package' => $package];
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Methods: GET');
header('Content-Type: application/json');
echo json_encode($response, JSON_UNESCAPED_SLASHES);
Example #3
0
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header('HTTP/1.1 405 Method not allowed');
    echo '{"error":"Method not allowed, only use POST"}';
    exit;
}
$authUser = @$_POST['user'];
$authPass = @$_POST['pass'];
$package = @$_POST['package'];
$authed = false;
foreach ($queueAuth as $auth) {
    $user = (string) key($auth);
    $pass = $auth[$user];
    if ($authUser == $user && $authPass == $pass) {
        $authed |= true;
    }
    if ($authed) {
        break;
    }
}
if ($authed === false) {
    header('HTTP/1.1 401 Unauthorized');
    echo '{"error":"Unauthorized"}';
    exit;
}
if ($package == null) {
    header('HTTP/1.1 400 Bad Data');
    echo '{"error":"Bad Data: package was empty"}';
    exit;
}
RedisQ\RedisQ::queueObject($package);
echo '{"success":true}';