$page = 1;
if (isset($_POST['page']) && is_numeric($_POST['page'])) {
    if ($_POST['page'] < 1) {
        $page = 1;
    } elseif ($_POST['page'] > ceil($page_total_count / PAGER_PP)) {
        $page = ceil($page_total_count / PAGER_PP);
    } else {
        $page = $_POST['page'];
    }
}
$sql = "SELECT p.id_page, username, name, picture, location, is_verified, p.likes total_likes, plf.likes local_likes, talking_about, first_local_fans_country \n\t           FROM facebook_page p JOIN facebook_page_local_fans_country plf ON p.id_page = plf.id_page \n\t           WHERE id_country = " . mysql_real_escape_string($id_country) . " \n\t               AND plf.date = '" . $local_fans_last_date . "' \n\t               AND active = 1 \n\t           ORDER BY local_likes DESC, total_likes DESC, talking_about DESC \n\t           LIMIT " . PAGER_PP * ($page - 1) . ", " . PAGER_PP . ";";
$res = mysql_query($sql) or die(mysql_error());
$cont = 1 + PAGER_PP * ($page - 1);
while ($fila = mysql_fetch_assoc($res)) {
    $crecimiento_fans = array('semana' => array('value' => $n_a, 'porcentaje' => $n_a));
    $fb_page_likes_last_update = get_fb_page_likes_last_update($fila['id_page']);
    $fb_page_likes_nun_dates = get_fb_page_likes_nun_dates($fila['id_page']);
    if ($fb_page_likes_nun_dates > 7) {
        $crecimiento_fans['semana'] = getCrecimientoFacebookFansPage($fila['id_page'], $fb_page_likes_last_update, 7);
    }
    ?>
                <div class="owloo_ranking_item">
                    <div class="owloo_rank"><?php 
    echo str_pad($cont++, 2, '0', STR_PAD_LEFT);
    ?>
</div>
                    <div class="owloo_fb_username">
                        <div class="owloo_fb_avatar">
                            <a href="<?php 
    echo URL_ROOT;
    ?>
Example #2
0
$id_country_uses = array();
$query = 'SELECT * FROM facebook_page WHERE active = 1 ORDER BY id_page;';
$que_pages = db_query($query, array());
while ($pages = mysql_fetch_assoc($que_pages)) {
    $id_page = $pages['id_page'];
    $parent = !empty($pages['parent']) ? $pages['parent'] : "0";
    $fb_id = $pages['fb_id'];
    $username = $pages['username'];
    $name = $pages['name'];
    $about = $pages['about'];
    $description = !empty($pages['description']) ? $pages['description'] : "NULL";
    $link = $pages['link'];
    $picture = $pages['picture'];
    $cover = $pages['cover'];
    $is_verified = $pages['is_verified'];
    $fb_page_likes_last_update = get_fb_page_likes_last_update($id_page);
    $fb_page_likes_nun_dates = get_fb_page_likes_nun_dates($id_page);
    $history = getHistory30Array($id_page, $fb_page_likes_last_update);
    $likes = $pages['likes'];
    $likes_history_30 = json_encode($history['likes']);
    $likes_grow_1 = "NULL";
    $likes_grow_7 = "NULL";
    $likes_grow_15 = "NULL";
    $likes_grow_30 = "NULL";
    $likes_grow_60 = "NULL";
    $talking_about = $pages['talking_about'];
    $talking_about_history_30 = json_encode($history['talking_about']);
    $talking_about_grow_1 = "NULL";
    $talking_about_grow_7 = "NULL";
    $talking_about_grow_15 = "NULL";
    $talking_about_grow_30 = "NULL";
Example #3
0
                                         <div>Favor, intentelo más tarde...</div>';
        }
    }
} while ($_first_repeat && $need_repeat);
if (!empty($page_data) && $page_data['active'] == 0) {
    header('Location: ' . URL_ROOT . 'facebook-stats/pages/hispanic/');
    exit;
}
if (empty($mensaje_new_fan_page)) {
    $local_fans_last_date = get_fb_page_local_fans_last_date($page_data['id_page']);
    $local_fans_country = NULL;
    if (!empty($local_fans_last_date)) {
        $sql = "SELECT c.id_country id_country, name, nombre, likes FROM facebook_page_local_fans_country lf JOIN country c ON lf.id_country = c.id_country WHERE id_page = " . mysql_real_escape_string($page_data['id_page']) . " AND date = '" . mysql_real_escape_string($local_fans_last_date) . "' ORDER BY likes DESC, nombre ASC;";
        $local_fans_country = mysql_query($sql) or die(mysql_error());
    }
    $fb_page_likes_last_update = get_fb_page_likes_last_update($page_data['id_page']);
    $fb_page_likes_nun_dates = get_fb_page_likes_nun_dates($page_data['id_page']);
    if ($fb_page_likes_nun_dates > 1) {
        $crecimiento_fans['dia'] = getCrecimientoFacebookFansPage($page_data['id_page'], $fb_page_likes_last_update, 1);
    }
    if ($fb_page_likes_nun_dates > 7) {
        $crecimiento_fans['semana'] = getCrecimientoFacebookFansPage($page_data['id_page'], $fb_page_likes_last_update, 7);
    }
    if ($fb_page_likes_nun_dates > 15) {
        $crecimiento_fans['quincena'] = getCrecimientoFacebookFansPage($page_data['id_page'], $fb_page_likes_last_update, 15);
    }
    if ($fb_page_likes_nun_dates > 30) {
        $crecimiento_fans['mes'] = getCrecimientoFacebookFansPage($page_data['id_page'], $fb_page_likes_last_update, 30);
    }
    if ($fb_page_likes_nun_dates > 60) {
        $crecimiento_fans['dos_meses'] = getCrecimientoFacebookFansPage($page_data['id_page'], $fb_page_likes_last_update, 60);
<?php

require_once '../../owloo_config.php';
if (!isset($_GET['page'])) {
    header('Location: ' . URL_ROOT);
    exit;
}
$sql = "SELECT * FROM facebook_page WHERE username LIKE '" . mysql_real_escape_string($_GET['page']) . "' AND active = 1;";
$res = mysql_query($sql) or die(mysql_error());
if (!($page_data = mysql_fetch_assoc($res))) {
    header('Location: ' . URL_ROOT);
    exit;
}
$value_gauge = owlooFormatPorcent($page_data['talking_about'], $page_data['likes'], 2, '.', '');
/********************************* CHART: Historial de total de fans en los ultimos 30 dias ***************************************/
$sql = "SELECT likes, talking_about, date \n                FROM facebook_pages_likes_talking_about \n                WHERE id_page = " . mysql_real_escape_string($page_data['id_page']) . "\n                    AND DATE_SUB(STR_TO_DATE('" . get_fb_page_likes_last_update($page_data['id_page']) . "', '%Y-%m-%d'),INTERVAL 30 DAY) <= date\n                ORDER BY date ASC;\n                ";
$que = mysql_query($sql) or die(mysql_error());
$seriesData = "";
//Estadística vertical. Cantidad de usuarios que posee en Facebook
$seriesData_talking_about = "";
//Estadística vertical. Cantidad de usuarios que posee en Facebook
$seriesDataMin = 0;
//Número mínimo de usuarios
$seriesDataMax = 0;
//Número máximo de usuarios
$seriesDataMin_talking_about = 0;
//Número mínimo de usuarios
$seriesDataMax_talking_about = 0;
//Número máximo de usuarios
$xAxisCategories = "";
//Estadística horizontal. Fechas de los datos