function OS_CheckCaptchaRegistration()
 {
     $error = "";
     if (isset($_SESSION["r_code"]) and $_SESSION["r_code"] == "OK") {
         /* CAPTCHA OK */
     } else {
         if (isset($_POST["register_"])) {
             $error = "";
             if (!isset($_POST["r_captcha"]) or !isset($_SESSION["r_code"])) {
                 $error .= "<h2>Invalid captcha form</h2>";
             } else {
                 if ($_POST["r_captcha"] != $_SESSION["r_code"]) {
                     $error .= "<h2>Invalid captcha code</h2>";
                 } else {
                     if (!isset($_SESSION["r_trap1"]) or !isset($_SESSION["r_trap2"])) {
                         $error .= "<h2>Invalid captcha form</h2>";
                     } else {
                         if (!isset($_POST[$_SESSION["r_trap1"]])) {
                             $error .= "<h2>Invalid captcha form</h2>";
                         } else {
                             if (isset($_SESSION["r_trap1"]) and isset($_SESSION["r_trap2"]) and isset($_POST[$_SESSION["r_trap1"]]) and $_SESSION["r_trap2"] != $_POST[$_SESSION["r_trap1"]]) {
                                 $error .= "<h2>Invalid captcha form</h2>";
                             }
                         }
                     }
                 }
             }
             if (!empty($error)) {
                 os_trigger_error($error . " ");
             }
             $_SESSION["r_code"] = "OK";
         }
     }
 }
Example #2
0
 function OS_CheckCaptcha()
 {
     if (isset($_POST["post_comment"])) {
         if (isset($_GET["post_id"]) and is_numeric($_GET["post_id"])) {
             $backTo = OS_HOME . '?post_id=' . safeEscape($_GET["post_id"]) . "&amp;" . generate_hash(12) . "#SubmitComment";
         } else {
             $backTo = '';
         }
         $CaptchaError = '<h2>Invalid captcha</h2><div><a href="' . $backTo . '">&laquo; Back</a></div>';
         if (!isset($_POST["c_code"]) or !isset($_SESSION["c_code"])) {
             os_trigger_error($CaptchaError);
         }
         if ($_POST["c_code"] != $_SESSION["c_code"]) {
             os_trigger_error($CaptchaError . " ");
         } else {
             $code = generate_hash(5);
             $code = str_replace(array("o", "0"), array("x", "x"), $code);
             $_SESSION["c_code"] = $code;
         }
     }
 }
Example #3
0
}
if ($OS_INSTALLED == 0) {
    require_once "install/install.php";
    die;
} else {
    if (file_exists("install")) {
        os_trigger_error("Please delete <b>install/</b> folder");
    }
    if (file_exists("install/install.php")) {
        os_trigger_error("Please delete or rename <b>install.php</b>");
    }
    if (file_exists("sql_data.sql")) {
        os_trigger_error("Please delete or rename <b>sql_data.sql</b>");
    }
    if (file_exists("sql_heroes_items.sql")) {
        os_trigger_error("Please delete or rename <b>sql_heroes_items.sql</b>");
    }
}
function get_value_of($name, $file = "../config.php")
{
    $lines = file($file);
    $val = array();
    foreach (array_values($lines) as $line) {
        if (strstr($line, "=")) {
            list($key, $val) = explode('=', trim($line));
            if (trim($key) == $name) {
                $val = str_replace(";", "", $val);
                $val = str_replace("'", "", $val);
                $val = str_replace('"', "", $val);
                return $val;
            }