Esempio n. 1
0
 static function activation()
 {
     $options = array();
     $options['user'] = restrictAccess::createUser();
     $options['feed'] = 'on';
     $options['nbquestions'] = 10;
     $options['questions'] = array();
     $options['reponses'] = array();
     add_option('restrictAccess', $options);
 }
Esempio n. 2
0
$reponses = $options['reponses'];
if (count($questions) != count($reponses)) {
    wp_die('Redirect Access : Erreur dans la préparation des questions.');
} else {
    $count = count($questions);
}
if (isset($_POST['unlock']) and is_array($_POST['unlock'])) {
    if ($count != count($_POST['reponse'])) {
        wp_die('Tricher, c\'est mal...');
    } else {
        if (isset($_POST['nom'])) {
            $nom = strip_tags(stripslashes($_POST['nom']));
            //$_SESSION['username'] = $nom;
            if (!empty($nom)) {
                if (restrictAccess::validate($_POST['reponse'], $reponses)) {
                    restrictAccess::autoLogin();
                    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
                    } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
                        $ip = $_SERVER['HTTP_CLIENT_IP'];
                    } else {
                        $ip = $_SERVER['REMOTE_ADDR'];
                    }
                    $infosclient = '<hr /><p>IP : <a href="http://ipgetinfo.com/index.php?ip=' . $ip . '">' . $ip . '</a><br />';
                    if (!empty($_SERVER['GEOIP_COUNTRY_NAME'])) {
                        $infosclient .= 'Localisation : ' . utf8_encode($_SERVER['GEOIP_CITY']) . ', ' . $_SERVER['GEOIP_COUNTRY_NAME'] . ' (<a href="http://maps.google.com/maps?q=' . $_SERVER['GEOIP_LATITUDE'] . ',' . $_SERVER['GEOIP_LONGITUDE'] . '">carte</a>)<br />';
                    }
                    require_once dirname(__FILE__) . '/libs/useragent.class.php';
                    $ua = new UserAgent();
                    $infosclient .= 'User-agent : ' . $ua->getUserAgent() . '<br />';
                    $infosclient .= 'Navigateur : ' . $ua->getBrowser() . ' ' . $ua->getBrowserVersion() . '<br />';