Exemple #1
0
 public static function generateByDefaultKey($app, $captchaType, $charCnt, $clientIp, $effactiveTime)
 {
     /*{{{*/
     DBC::requireTrue($effactiveTime < 60, "有效时间不能超过1小时");
     $contentObj = ContentFactory::generate($captchaType);
     $contentArr = $contentObj->generate($charCnt);
     $handler = new QBase64();
     $key = self::generateID();
     $token = $handler->crypt(microtime() . $app . $key);
     $expireTime = XDateTime::now()->addMinute($effactiveTime)->getTime();
     $originalValues = array('app' => $app, 'key' => $key, 'ip' => $clientIp, 'expiretime' => $expireTime, 'answer' => strtolower($contentArr['answer']), 'question' => $contentArr['question']);
     $cacher = Cacher::get()->getCache(Cacher::CACHETYPE_CAPTCHA);
     $cacher->add($token, $originalValues);
     return array('token' => $token, 'captchaId' => $key);
 }
Exemple #2
0
			<?php 
//factory qui crée un tableau d'objets à administrer selon la valeur du paramètre $_GET['page']
if (isset($_GET["page"])) {
    if (isset($_GET["mode"]) && is_numeric($_GET["mode"])) {
        if ($_GET["mode"] == 1) {
            $content = ContentFactory::build($_GET["page"]);
            echo "<h1>Contenu &agrave; ajouter : <h1>";
            $content->form_add->display("treatment.php?mode=1", "post");
        } else {
            $pdo_singleton = new PDOSingleton();
            if (isset($_GET['id']) && is_numeric($_GET['id'])) {
                $content = ContentFactory::build($_GET["page"], $_GET["id"]);
                echo "<h1>Contenu &agrave; modifier : <h1>";
                $content->form_modify->display("treatment.php?mode=2", "post");
            } else {
                $array = ContentFactory::buildArray($_GET["page"]);
                echo "<h1>Contenu disponible : <h1>";
                $array->display_list();
            }
        }
    }
} else {
    echo "<h1>Bienvenue sur l'espace d'administration</h1>";
}
?>
		</section>
		
		<?php 
include_once "footer_admin.php";
?>
		<script>