<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(0);
require_once __DIR__ . '/../vendor/autoload.php';
if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}
Grosona\Config::setBase(__DIR__ . '/../app/config');
$grosona = new Grosona\GrosonaDriver();
$config = Grosona\Config::getConfig();
$dba = new Grosona\Comm\DatabaseAccessor($config['dbServerName'], $config['dbUserName'], $config['dbPassword'], $config['dbName'], $config['groupId'], 0, new Grosona\Utility\Logger($config['logFile'], ''));
$funct = filter_input(INPUT_GET, 'f');
if ('get' === $funct) {
    $fids = $dba->queryAssoc("SELECT `feed_id` FROM `grosona__images` WHERE `image_path`='aa' ORDER BY RAND() LIMIT 1");
    while ($fids) {
        $fid = $fids[0]['feed_id'];
        $syntax = "/{$fid}?fields=id, from, message, type, created_time, updated_time, attachments";
        $query = new Grosona\FacebookQuery();
        $query->setProperty(SYNTAX, $syntax);
        $query->setProperty(ITERATE_COUNT, 0);
        $query->setProperty(TYPE, TYPE_FEED);
        $query->setProperty(FEED_ID, $fid);
        $query->setProperty(CONTINUED_INDEX, 0);
        $grosona->getFacebookQuerier()->setQuery($query);
        $result = $grosona->getFacebookQuerier()->execute();
        if ($result) {
            $feed = $result->toAssoc();
            foreach ($feed['imageSet'] as $imgInfo) {
                $grosona->getFeedQuerier()->updateImage($imgInfo);
<?php

require_once __DIR__ . '/../vendor/autoload.php';
Grosona\Config::setBase(__DIR__ . '/../app/config');
if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}
$grosona = new Grosona\GrosonaDriver();
if ($grosona->getStatus()['userId']) {
    if ($grosona->getStatus()['isUser']) {
        $_SESSION['aaa'] = 'yesiam';
        header("Location: app.php/");
    } else {
        header("Location: https://www.facebook.com/groups/451890044925648/");
    }
} else {
    header("Location: app.php/login");
}