예제 #1
0
파일: indexTest.php 프로젝트: balvarob/test
    <div class="container">
 
        <div class="row">
            <div class="col-xs-12 text-center">
             <?php 
///////////////////CONTENIDO DEL TEST////////////////////
//por defecto se muestran todos
$test = array();
$connection = connectDb();
//establecemos conexion con la base de datos.
$resultIdsCategory = $connection->query("SELECT id FROM " . TABLE_PREFIX . TABLE_TITLE . " where active = 1");
$tempArrayIdsCategory = array();
while ($temp = $resultIdsCategory->fetch_assoc()) {
    $tempArrayIdsCategory[] = intval($temp["id"]);
}
$test = validateResponse($test, $tempArrayIdsCategory);
//comprobamos los valores de respuesta de la pagina y syncronizamos los datos con el array.
if (count($test) == 0) {
    $count = 0;
    foreach ($tempArrayIdsCategory as $key => $value) {
        $test[$value] = intval($value);
        $count++;
    }
}
$blockHtml = "";
//para mostrar los test validos.
foreach ($test as $key => $value) {
    //echo "\$test[$key] => $value\n";
    $result = $connection->query("SELECT id, title, image, description FROM " . TABLE_PREFIX . TABLE_TITLE . " where id = " . $key . " and active = 1");
    while ($fila = $result->fetch_assoc()) {
        //printf ("%s %s %s %s</br>", "id: ". $fila["id"],utf8_encode($fila["title"]),utf8_encode($fila["image"]),utf8_encode($fila["description"]));
예제 #2
0
$response = $pubnub->pamGrantChannelGroup(1, 0, $group);
validateResponse($response);
## To current instance
$response = $pubnub->pamGrantChannelGroup(0, 1, $group, $bootstrap_auth);
validateResponse($response);
## To chat
$response = $pubnub->grant(1, 1, $chat);
validateResponse($response);
## To history
$response = $pubnub->grant(1, 0, $history);
validateResponse($response);
## To stock tickers
$response = $pubnub->grant(0, 1, join(",", $channels), $auth_key);
validateResponse($response);
## ---------------------------------------------------------------------------
## Cleanup channel group and add current channels to it
## ---------------------------------------------------------------------------
$response = $pubnub->channelGroupRemoveGroup($group);
validateResponse($response);
$response = $pubnub->channelGroupAddChannel($group, $channels);
validateResponse($response);
echo "\n";
## ---------------------------------------------------------------------------
## Helpers
## ---------------------------------------------------------------------------
function validateResponse($res)
{
    if (is_array($res) && in_array("error", $res) && $res["error"] == 1) {
        echo $res["service"] . " response code " . $res["status"] . ": " . $res["message"] . "\n";
    }
}