Example #1
0
*/
if (!is_numeric($_REQUEST['feed_id'])) {
    die('feed_id parameter not present');
} else {
    $feed_id = $_REQUEST['feed_id'];
}
$importer = new xmlFeedImporter($feed_id);
if ($importer->feed_row['pickup_method'] == 'POST') {
    $hosts = array();
    $hosts = explode(',', $importer->feed_row['ip_allow']);
    $allowed = false;
    if (sizeof($hosts) > 0) {
        foreach ($hosts as $host) {
            if (strtoupper($host) == 'ALL') {
                // all hosts
                $allowed = true;
            }
            if (strtolower($host) == 'localhost' && $_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
                $allowed = true;
            }
            if ($host == $_SERVER['REMOTE_ADDR']) {
                $allowed = true;
            }
        }
        if (!$allowed) {
            $importer->set_import_error('Blocked access from: ' . $_SERVER['REMOTE_ADDR']);
            die('Access is restricted form your IP. Please contact ' . JB_SITE_CONTACT_EMAIL);
        }
    }
    $importer->import();
}