Beispiel #1
0
function verifier_token($nom, $referer = "", $temps = 0)
{
    global $thisSite;
    session_start();
    if (!is_unsigned_integer($temps) || $temps == 0) {
        $temps = 15 * 60;
    }
    if (!isset($_SESSION[$nom . '_token'])) {
        return false;
    }
    if (isset($_SESSION[$nom . '_token']) && isset($_SESSION[$nom . '_token_time']) && isset($_POST['token'])) {
        if ($_SESSION[$nom . '_token'] == $_POST['token']) {
            if ($_SESSION[$nom . '_token_time'] >= time() - $temps) {
                if ($thisSite->current_lang != "") {
                    $HTTP_REFERER = str_replace($thisSite->current_lang . "/", "", $_SERVER['HTTP_REFERER']);
                } else {
                    $HTTP_REFERER = $_SERVER['HTTP_REFERER'];
                }
            }
        }
    }
    //	echo($_SERVER['HTTP_REFERER']."<br>");
    //	echo($HTTP_REFERER."<br>");
    //	echo($referer."<br>");
    if ($HTTP_REFERER == $referer || $referer == "") {
        unset($_SESSION[$nom . '_token']);
        return true;
    }
    return false;
}
Beispiel #2
0
function test_date($jj, $mm, $aa)
{
    if (!is_unsigned_integer($jj) || !is_unsigned_integer($mm) || !is_unsigned_integer($aa)) {
        return false;
    }
    $aaaa = "20" . $aa;
    if (checkdate(intval($mm), intval($jj), intval($aaaa))) {
        return true;
    }
    return false;
}
Beispiel #3
0
 public function addCounter($field)
 {
     global $myAdmin;
     global $datas_lang;
     global $thisSite;
     if (is_unsigned_integer($this->counter)) {
         $dataCounter = "countType:'characters', maxCount:" . $this->counter . ", strictMax:true";
     } else {
         $dataCounter = $this->counter;
     }
     if ($this->counter != "") {
         $data = "<div class='counter'>" . $datas_lang["counter_characters"] . "<span id='counter_" . $field . "'></span></div>";
         $data .= "<script>\$('#" . $field . "').simplyCountable({ counter:'#counter_" . $field . "', " . $dataCounter . "});</script>";
         return $data;
     }
 }