コード例 #1
0
 function checkCaptcha()
 {
     global $PASSWORD, $error;
     if (!empty($PASSWORD) || $this->permanent && $_COOKIE["LW_CAPTCHA"] == $this->cookie_password) {
         return false;
     }
     $question_id = $_REQUEST["qid"];
     $answer = trim($_REQUEST["ans"]);
     if (empty($question_id) || empty($answer) || !is_numeric($question_id)) {
         return true;
     }
     $right_answers = explode(",", $this->getQuestion($question_id, 2));
     $equals = false;
     foreach ($right_answers as $a) {
         if (!strcasecmp(trim($a), $answer)) {
             $equals = true;
             $_COOKIE['LW_CAPTCHA'] = $this->cookie_password;
             if ($this->permanent) {
                 setsafecookie('LW_CAPTCHA', $this->cookie_password, time() + 365 * 24 * 3600);
             }
             break;
         }
     }
     if (!$equals) {
         $error = "Captcha plugin: Given answer is not correct. Try again.";
     }
     return !$equals;
 }
コード例 #2
0
 function authentified()
 {
     if (strlen($this->PASSWORD) > 0 && $_COOKIE["LW_ADMIN"] == $this->PASSWORD || isset($_POST["sc"]) && sha1($_POST["sc"]) == $this->PASSWORD) {
         setsafecookie("LW_ADMIN", $this->PASSWORD, time() + $this->expire_login);
         return true;
     } else {
         return false;
     }
 }
コード例 #3
0
ファイル: old_index.php プロジェクト: pastak/jichikai_web
function authentified()
{
    if (!$GLOBALS['PASSWORD'] || !strcasecmp($_COOKIE['LW_AUT'], $GLOBALS['PASSWORD']) || !strcasecmp(sha1($GLOBALS['sc']), $GLOBALS['PASSWORD'])) {
        setsafecookie('LW_AUT', $GLOBALS['PASSWORD'], time() + ($GLOBALS['PROTECTED_READ'] ? 4 * 3600 : 365 * 86400));
        return true;
    } else {
        return false;
    }
}