static function startpage($config) { header("Access-Control-Allow-Origin: *"); header('Content-Type: application/json'); APIHelpers::$TIMESTART = microtime(true); $issetToken = APIHelpers::issetParam('token'); if ($issetToken) { APIHelpers::$TOKEN = APIHelpers::getParam('token', ''); $conn = APIHelpers::createConnection($config); try { $stmt = $conn->prepare('SELECT data FROM users_tokens WHERE token = ? AND status = ? AND end_date > NOW()'); $stmt->execute(array(APIHelpers::$TOKEN, 'active')); if ($row = $stmt->fetch()) { APIHelpers::$FHQSESSION = json_decode($row['data'], true); APIHelpers::$FHQSESSION_ORIG = json_decode($row['data'], true); } } catch (PDOException $e) { APIHelpers::showerror(1188, $e->getMessage()); } } else { APIHelpers::$FHQSESSION = $_SESSION; APIHelpers::$FHQSESSION_ORIG = $_SESSION; } $response = array('result' => 'fail', 'lead_time_sec' => 0, 'data' => array()); return $response; }