Beispiel #1
0
require_once CLASS_DIR . "timers.class.php";
$maintimer = new timer();
$maintimer->timer();
// $download_dir should always end with '/'
if (substr($options["download_dir"], -1) != '/') {
    $options["download_dir"] .= '/';
}
define('DOWNLOAD_DIR', substr($options["download_dir"], 0, 6) == "ftp://" ? '' : $options["download_dir"]);
define('TEMPLATE_DIR', 'tpl/' . $options['template_used'] . '/');
define('IMAGE_DIR', TEMPLATE_DIR . 'skin/' . $options["csstype"] . '/');
// Language initialisation
require_once CLASS_DIR . "lang.class.php";
$L = new RxLang();
$charSet = $L->settings["charset"];
// Check DOWNLOAD_DIR and FILES_LST
$czFlst = checkExistence();
// Strict check firbidden file in DOWNLOAD_DIR
checkStrict();
define('THIS_SCRIPT', basename($PHP_SELF));
// check for forbidden page (audl, auul, lynx, mtn)
$keyfn = str_replace("." . get_extension(THIS_SCRIPT), "", THIS_SCRIPT);
if (isset($options['forbid'][$keyfn]) && $options['forbid'][$keyfn]) {
    get_tpl("404", ucwords(do_strtolower($keyfn)) . " " . $L->say["disabled"]);
    exit;
}
// Load server spec
$server = getServerPlatf();
// Load visitor class, user ip defined in here
require_once CLASS_DIR . 'visitors.class.php';
$visitors = new Visitor();
switch (THIS_SCRIPT) {
include "../databaseInfo.php";
if (empty($_POST["submit"]) && empty($_POST["g-recaptcha-response"]) && empty($_POST["username"])) {
    displayForm("");
}
if (!empty($_POST["submit"]) && (empty($_POST["g-recaptcha-response"]) || empty($_POST["username"]))) {
    displayForm("incomplete");
} elseif (!empty($_POST["submit"]) && !empty($_POST["g-recaptcha-response"]) && !empty($_POST["username"])) {
    if (isValid($_POST["g-recaptcha-response"])) {
        if (checkExistence(trim($_POST["username"])) == admin) {
            if (automatedPasswordReset(trim($_POST["username"]), "admin")) {
                displayForm("success");
            } else {
                displayForm("tech_diff");
            }
        } elseif (checkExistence(trim($_POST["username"])) == member) {
            if (automatedPasswordReset(trim($_POST["username"]), "member")) {
                displayForm("success");
            } else {
                displayForm("tech_diff");
            }
        } else {
            displayForm("nonexistant");
        }
    } else {
        displayForm("verfication_prob");
    }
}
function isValid($captcha)
{
    $secret = "6LfnWRgTAAAAAOjb5kqADRu_BPY-Ez7KLZwlF7mH";
}
try {
    $latest_data = scraperwiki::sqliteexecute("select kitaID from swdata order by kitaID desc limit 1");
} catch (Exception $e) {
    $latest_data = 0;
}
$next_id = max($latest_data->data[0][0], 10056);
for ($i = $next_id; $i <= 25000; $i++) {
    $html = null;
    $url = 'http://www.berlin.de/sen/familie/kindertagesbetreuung/kita_verzeichnis/anwendung/kitaDetails.aspx?ID=' . $i;
    while (is_null($html)) {
        try {
            $html = scraperwiki::scrape($url);
            $exists = checkExistence($html);
            while (strcmp($exists, "error") == 0) {
                print "error -> sleep 5 seconds";
                sleep(5);
                $html = scraperwiki::scrape($url);
                $exists = checkExistence($html);
            }
        } catch (Exception $e) {
            var_dump($e);
            sleep(5);
            $html = null;
        }
    }
    if (strlen($exists) > 0) {
        var_dump($url);
        parseDetails($exists, $i, $html);
    }
}