本文整理汇总了PHP中captcha函数的典型用法代码示例。如果您正苦于以下问题:PHP captcha函数的具体用法?PHP captcha怎么用?PHP captcha使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了captcha函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register()
{
if (is_post()) {
$this->loadHelper('Validator');
if (captcha()) {
$data = ['email' => validate('email', 'email'), 'username' => validate('required', 'username'), 'password' => password_hash(validate('required', 'register_token'), PASSWORD_BCRYPT), 'token' => str_rand(40)];
if (validator($data)) {
if ($this->user->checkExistUser($data['email'])) {
$data2 = ['firstname' => validate('required', 'firstname'), 'lastname' => validate('required', 'lastname'), 'nickname' => validate('required', 'nickname'), 'major' => validate('required', 'major')];
if (validator($data2)) {
$this->user->createUser($data, $data2);
$validate = $this->user->validate($data['email'], $_POST['register_token']);
if (!empty($validate)) {
$_SESSION['auth'] = $validate;
$_SESSION['user'] = $this->user->getDetail($validate['id']);
cache_forgot('user.members.' . user('major'));
cache_forgot('user.get.members.' . user('major'));
}
}
}
}
}
}
return redirect('');
}
示例2: regform
function regform()
{
$value = captcha(5);
$_SESSION['code'] = $value;
$form = '<h1>Register</h1>
<form action="index.php?var=register" method="POST">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="25%">Name:</td>
<td width="75%"><input name="uname" id="uname" type="text" maxchars="255" size="20" /></td>
</tr><tr>
<td width="25%">Password:</td>
<td width="75%"><input name="pass1" id="pass1" type="password" maxchars="255" size="20" /></td>
</tr><tr>
<td width="25%">Repeat Password:</td>
<td width="75%"><input name="pass2" id="pass2" type="password" maxchars="255" size="20" /></td>
</tr><tr>
<td width="25%">Email:</td>
<td width="75%"><input name="email1" id="email1" type="text" maxchars="255" size="20" /></td>
</tr><tr>
<td width="25%">Repeat Email:</td>
<td width="75%"><input name="email2" id="email2" type="text" maxchars="255" size="20" /></td>
</tr><tr>
<td><img src="images/verify.jpeg" /></td>
<td>Verification Code:<br><input type="text" name="img" id="img" maxchars="5" size="20"/></td>
<tr><td></td><td><input type="submit" value="Register!" /></td></tr>
</table>
</form>';
return $form;
}
示例3: output
function output()
{
global $db, $ums, $user;
$code = captcha(5);
$out = "<form action=\"?var=regsub\" method=\"POST\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>Username:</td>\n<td><input type=\"text\" name=\"uname\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Password:</td>\n<td><input type=\"password\" name=\"pass1\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Confirm Password:</td>\n<td><input type=\"password\" name=\"pass2\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Email:</td>\n<td><input type=\"text\" name=\"email1\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Confirm Email:</td>\n<td><input type=\"text\" name=\"email2\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td><img src=\"images/verify.jpeg\" /></td>\n<td>Verification Code:<br />\n<input type=\"text\" name=\"code\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td></td>\n<td><input type=\"submit\" value=\"Register\" /></td>\n</tr>\n</table>\n</font>";
$_SESSION['code'] = $code;
return $out;
}
示例4: testValidationSuccess
/**
* バリデーションが正しく通ることをテストします
*/
public function testValidationSuccess()
{
captcha();
$phrase = session('captcha.phrase');
$this->request['name'] = 'testing';
$this->request['email'] = 'testing@example.com';
$this->request['password'] = 'testing';
$this->request['password_confirmation'] = 'testing';
$this->request['captcha_code'] = $phrase;
$this->assertNull($this->request->validate());
}
示例5: secure_tracks
function secure_tracks()
{
$scod = substr(microtime(), 2, 4);
$im = plugin('imgtxt', $scod, "crackman", "ok");
$ret = hidden('secur', 'trkscr', captcha($scod));
if (!rstr(15)) {
return $ret . hidden('', 'trkscrvrf', $scod);
}
if (prms('nogdf') or !$im) {
$ret .= btn('txtcadr', $scod);
} else {
$ret .= $im;
}
$ret .= autoclic('secure" id="trkscrvrf', helps('track_captcha'), '14', '5', '') . ' ';
return $ret;
}
示例6: exit_error
if (HEBERGEUR_INSTALLATION == 'multi-structures') {
$structure_denomination = DB_WEBMESTRE_PUBLIC::DB_recuperer_structure_nom_for_Id($BASE);
if ($structure_denomination === NULL) {
exit_error('Établissement manquant', 'Établissement non trouvé dans la base d\'administration !');
}
} else {
$DB_TAB = DB_STRUCTURE_PUBLIC::DB_lister_parametres('"webmestre_denomination"');
if (!empty($DB_TAB)) {
$structure_denomination = $DB_TAB[0]['parametre_valeur'];
} else {
exit_error('Base incomplète', 'Base de l\'établissement incomplète ou non encore installée !');
}
}
}
// Protection contre les attaques par force brute des robots (piratage compte ou envoi intempestif de courriels)
list($html_imgs, $captcha_soluce) = captcha();
$_SESSION['FORCEBRUTE'][$PAGE] = array('TIME' => $_SERVER['REQUEST_TIME'], 'DELAI' => 5, 'CAPTCHA' => $captcha_soluce);
$is_etablissement_virtuel = IS_HEBERGEMENT_SESAMATH && ($BASE == ID_DEMO || $BASE >= CONVENTION_ENT_ID_ETABL_MAXI || substr($structure_denomination, 0, 5) == 'Voir ') ? TRUE : FALSE;
?>
<?php
if ($PROFIL == 'structure' && !$is_etablissement_virtuel) {
?>
<form id="form_lost" action="#" method="post">
<h2>Cas n°1 : une adresse de courriel est associée à votre compte</h2>
<div id="step1">
<p>Alors utilisez ce formulaire afin d'obtenir de nouveaux identifiants :</p>
<div><label class="tab">Établissement :</label><input id="f_base" name="f_base" type="hidden" value="<?php
echo $BASE;
?>
" /><em><?php
示例7: form
function form($array, $legend, $submit, $first, $last, $captcha = false)
{
if ($first) {
echo "<form method='post' action=''>";
}
echo '<fieldset>';
echo '<legend>' . $legend . '</legend>';
foreach ($array as &$value) {
if ($value['type'] != 'radio' && $value['label'] != '') {
echo '<label for="' . $value['name-id'] . '">' . $value['label'] . '</label>';
}
// Text, Email, Password
if ($value['type'] == 'text' || $value['type'] == 'email' || $value['type'] == 'password') {
echo '<input type="' . $value['type'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '" value="';
if ($value['value']) {
if ($_POST) {
echo $_POST[$value['name-id']];
} elseif (!empty($value['valuebyuser'])) {
echo $value['valuebyuser'];
}
} elseif (!empty($value['valuebyuser'])) {
echo $value['valuebyuser'];
}
echo '" />';
}
if ($value['type'] == 'textarea') {
echo '<textarea cols="' . $value['cols'] . '" rows="' . $value['rows'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '">';
if ($value['value']) {
if ($_POST) {
echo $_POST[$value['name-id']];
} elseif (!empty($value['valuebyuser'])) {
echo $value['valuebyuser'];
}
} elseif (!empty($value['valuebyuser'])) {
echo $value['valuebyuser'];
}
echo '</textarea>';
}
if ($value['type'] == 'radio') {
echo '<input type="' . $value['type'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '" value="' . $value['value'] . '"';
if ($value['checked']) {
echo ' checked="checked" ';
}
echo '/>' . $value['label'];
}
if ($value['type'] == 'select') {
echo '<select name="' . $value['name-id'] . '" id="' . $value['name-id'] . '">';
foreach ($value['options'] as $key => $v) {
echo '<option value="' . $key . '">' . $v . '</option>';
}
echo '</select>';
}
}
echo "</fieldset>";
if ($captcha) {
captcha();
}
if ($last) {
echo "<input type='submit' value='" . $submit . "'/>";
echo "</form>";
}
}
示例8: check_group
$need_question = $MOD['question_add'] == 2 ? $MG['question'] : $MOD['question_add'];
$could_color = check_group($_groupid, $MOD['group_color']) && $MOD['credit_color'] && $_userid;
if ($submit) {
if ($fee_add && $fee_add > ($fee_currency == 'money' ? $_money : $_credit)) {
dalert($L['balance_lack']);
}
if ($need_password && !is_payword($_username, $password)) {
dalert($L['error_payword']);
}
if ($MG['add_limit']) {
$last = $db->get_one("SELECT addtime FROM {$table} WHERE {$sql} ORDER BY itemid DESC");
if ($last && $DT_TIME - $last['addtime'] < $MG['add_limit']) {
dalert(lang($L['add_limit'], array($MG['add_limit'])));
}
}
$msg = captcha($captcha, $need_captcha, true);
if ($msg) {
dalert($msg);
}
$msg = question($answer, $need_question, true);
if ($msg) {
dalert($msg);
}
if (isset($post['islink'])) {
unset($post['islink']);
}
//$post['clear_link'] = $MOD['clear_link'];
if ($do->pass($post)) {
$CAT = get_cat($post['catid']);
if (!$CAT || !check_group($_groupid, $CAT['group_add'])) {
dalert(lang($L['group_add'], array($CAT['catname'])));
示例9: header
<?php
header("Content-Type: image/png");
session_start();
captcha();
function captcha()
{
$md5_hash = md5(rand(0, 999));
//some random number between 0 to 999 change to md5 and assign it to a variable
$security_code = substr($md5_hash, 15, 5);
//
$_SESSION['capt'] = $security_code;
///assigning values produced into the session
//this point below it changes the variable into an image
$im = imagecreate(40, 20) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 2, 3, 3, $security_code, $text_color);
imagepng($im);
imagedestroy($im);
}
示例10: captcha
<input type="text" name="email" id="email" value="" size="20" maxlength="80" tabindex="2"/>
</div>
<div>
<label for="comment">Your Comment: <span class="required">*</span>
<?php
if (isset($errors) && in_array('comment', $errors)) {
echo "<span class='warning'>Please enter your comment</span>";
}
?>
</label>
<div id="comment"><textarea name="comment" rows="10" cols="50" tabindex="3"></textarea></div>
</div>
<div>
<label for="captcha">Nhập giá trị số cho câu hỏi sau:<?php
echo captcha();
?>
<span class="required">*</span>
<?php
if (isset($errors) && in_array('captcha', $errors)) {
echo "<span class='warning'>Please give a correct answer</span>";
}
?>
</label>
<input type="text" name="captcha" id="captcha" value="" size="20" maxlength="5" tabindex="4"/>
</div>
<div class="website">
<label for="webside">Nếu bạn nhìn thấy trường này, thì ĐỪNG điền gì vô hết</label>
<input type="text" name="url" id="url" value="" size="20" maxlength="20"/>
</div>
示例11: mysql_real_escape_string
$errors[] = 'Parolanızı girmediniz.';
} else {
if ($_POST['password'] != $_POST['password_confirm']) {
// parola girilmişse ve confirm alanı ile aynı ise...
$errors[] = 'Girdiğiniz iki parola birbirinden farklı.';
} else {
if (!preg_match("/^((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#\$%]).{6,20})\$/", $_POST['password'])) {
$errors[] = 'Parolanız 6-20 karakter aralığında olmalıdır. Minimum 1 küçük, 1 büyük harf ve 1 rakam içermelidir. @#$% özel karakterlerinden birisini içermelidir.';
}
}
}
if (empty($errors)) {
// bütün alanlar kontrol edildiyse ($errors dizisi boş ise)
// kullanıcıdan gelen veriler filtreleniyor
$name = mysql_real_escape_string($_POST['name']);
$surname = mysql_real_escape_string($_POST['surname']);
$email = mysql_real_escape_string($_POST['email']);
$username = mysql_real_escape_string($_POST['username']);
$password = sha1($_POST['password']);
// parola sha1 algoritması ile hashleniyor
// kayıt veri tabanına ekleniyor
$query = mysql_query("INSERT INTO users\r\n (name, surname, email, username, password)\r\n VALUES\r\n ('{$name}', '{$surname}', '{$email}', '{$username}', '{$password}')\r\n ") or die(mysql_error());
// register_complete.php adresine yönlendirilme yapılıyor
header("Location: " . DOC_ROOT . "/register_complete.php");
exit;
}
}
$_SESSION['my_captcha'] = captcha();
require 'views/layout/header.php';
require 'views/register.php';
require 'views/layout/footer.php';
示例12: exit
} else {
$mobile = $_SESSION['f_key'];
$mobile == $t['mobile'] && $t['vmobile'] or exit('ko');
$_SESSION['mobile_code'] == md5($t['mobile'] . '|' . $code) or exit('ko');
set_cookie('username', $mobile);
}
$salt = random(8);
$pass = dpassword($password, $salt);
$db->query("UPDATE {$DT_PRE}member SET password='{$pass}',passsalt='{$salt}' WHERE userid='{$userid}'");
session_destroy();
exit('ok');
break;
case 'check':
isset($type) or exit('ko');
$captcha = isset($captcha) ? convert(input_trim($captcha), 'UTF-8', DT_CHARSET) : '';
$msg = captcha($captcha, 1, true);
if ($msg) {
exit('captcha');
}
if ($type == 'mobile') {
$could_mobile or exit('ko');
is_mobile($mobile) or exit('ko');
$t = $db->get_one("SELECT userid FROM {$DT_PRE}member WHERE mobile='{$mobile}' AND vmobile=1");
if ($t) {
$_SESSION['f_uid'] = $t['userid'];
$_SESSION['f_key'] = $mobile;
exit('ok');
}
exit('no');
} else {
if ($type == 'email') {
示例13: testWheninputIs2121ResultShouldBe1MultiplyOne
function testWheninputIs2121ResultShouldBe1MultiplyOne()
{
$this->assertEquals("1 * One", captcha(2, 1, 3, 1));
}
示例14: getSettingValue
echo getSettingValue("gepiSchoolName");
?>
: Récupération de compte et mot de passe...</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script src="lib/functions.js" type="text/javascript" language="javascript"></script>
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" />
<link rel="icon" type="image/ico" href="./favicon.ico" />
<?php
// Styles paramétrables depuis l'interface:
if ($style_screen_ajout == 'y') {
// La variable $style_screen_ajout se paramètre dans le /lib/global.inc
// C'est une sécurité... il suffit de passer la variable à 'n' pour désactiver ce fichier CSS
// et éventuellement rétablir un accès après avoir imposé une couleur noire sur noire
echo "<link rel='stylesheet' type='text/css' href='{$gepiPath}/style_screen_ajout.css' />\n";
}
echo "\n</head>\n";
if (isset($suite)) {
if (getSettingAOui('Imprimer_obtenir_compte_et_motdepasse')) {
echo "<body>\n<div style='margin:1em;'>\n<h2>" . getSettingValue('gepiSchoolName') . " : Demande de compte</h2>\n\n<p>Je souhaite obtenir (<em>ou récupérer</em>) un compte et mot de passe pour accéder aux données me concernant ou concernant mon ou mes enfants scolarisés dans l'établissement.</p>\n\n<table class='boireaus boireaus_alt'>\n\t<tr><td>Nom</td><td>{$nom}</td></tr>\n\t<tr><td>Prénom</td><td>{$prenom}</td></tr>\n\t<tr><td>Email</td><td>{$email}</td></tr>\n\t<tr><td>Statut</td><td>{$statut_demandeur}</td></tr>\n\t<tr>\n\t\t<td valign='top'>Description de la demande :</td>\n\t\t<td>\n\t\t\t" . preg_replace("/\\\\n/", "<br />", nl2br($description)) . "\n\t\t</td>\n\t</tr>\n</table>\n<p>Le " . strftime("%d/%m/%Y à %H:%M") . ".</p>\n<p>Signature :</p>\n<p><br /></p>\n<p><br /></p>\n<p style='text-decoration:blink; color:red;' class='noprint'>Document à imprimer et à remettre à l'Administration.</p>\n<p class='noprint'><a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a></p>\n\n</div>";
} else {
echo "<body>\n<div style='margin:1em;'>\n<h2>" . getSettingValue('gepiSchoolName') . " : Demande de compte</h2>\n\n<p>Votre demande a été enregistrée.</p>\n\n<p class='noprint'><a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a></p>\n\n</div>";
}
require "./lib/footer.inc.php";
die;
}
echo "<body onload=\"document.getElementById('nom').focus()\">\n\n<div class='norme' style='text-align:center;'>\n\t<p class='bold'>\n\t\t<a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a>\n\t</p>\n</div>\n\n<h2 class='gepi'>Demande de compte/mot de passe</h2>\n\n<div align='center'>\n\n\t<span style='color:red'>{$msg}</span>\n\n\t<p>Vous avez oublié vos compte et mot de passe, ou vous souhaitez obtenir un compte pour accéder aux données concernant votre enfant.<br />\n\tVeuillez compléter le formulaire ci-dessous.</p>\n\n\t<form enctype=\"multipart/form-data\" name= \"formulaire\" action=\"" . $_SERVER['PHP_SELF'] . "\" method='post'>\n\t<table class='boireaus boireaus_alt'>\n\t\t<tr><td>Nom</td><td><input type='text' name='nom' size='40' value=\"{$nom}\" /></td></tr>\n\t\t<tr><td>Prénom</td><td><input type='text' name='prenom' size='40' value=\"{$prenom}\" /></td></tr>\n\t\t<tr><td>Email</td><td><input type='text' name='email' size='40' value=\"{$email}\" /></td></tr>\n\t\t<tr>\n\t\t\t<td>Statut</td>\n\t\t\t<td>\n\t\t\t\t<select name='statut_demandeur'>\n\t\t\t\t\t<option value='parent'>parent ou responsable</option>\n\t\t\t\t\t<option value='eleve'>élève</option>\n\t\t\t\t\t<option value='autre'>autre</option>\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>Enfants/élèves</td>\n\t\t\t<td>\n\t\t\t\t<p>Dans le cas d'une demande parent/responsable, veuillez préciser les nom, prénom et classe<br />de l'un au moins de vos enfants scolarisés dans l'établissement.<br />\n\t\t\t\tDans le cas d'une demande élève, veuillez préciser vos nom, prénom et classe.</p>\n\t\t\t\t<textarea name='description' cols='50' rows='4'>" . preg_replace("/\\\\n/", "\n", $description) . "</textarea>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\n\t<strong><a href='http://fr.wikipedia.org/wiki/Captcha' target='_blank' title=\"Captcha : Dispositif destiné à contrôler que c'est bien un humain et non une machine/robot qui valide le formulaire.\">Captcha</a></strong><br />\n\t<label for='captcha'>Combien font " . captcha() . " ?</label><br /><input type='text' name='captcha' id='captcha' autocomplete=\"off\" /><br />\n\t<span style='font-size:x-small'>(réponse attendue en chiffres)</span>\n\t<br />\n\n\t<input type='hidden' name='is_posted' value='y' />\n\t<input type='submit' value='Valider' />\n\n\t</form>\n\n</div>\n\n<p><br /></p>\n\n<p><em>NOTES :</em></p>\n<ul>";
if (getSettingAOui('Imprimer_obtenir_compte_et_motdepasse')) {
echo "\n\t<li>\n\t\tUn document va être généré.<br />\n\t\tVous devrez imprimer le document et votre enfant devra déposer cette demande à l'Administration de l'établissement pour finaliser la demande.<br />\n\t\tCette démarche est destinée à éviter des usurpations d'identité.\n\t</li>";
}
echo "\n\t<li>\n\t\tEn précisant votre adresse mail, vous pourrez par la suite recevoir par mail les informations demandées.<br />\n\t\t(<em>Il est généralement plus facile de copier/coller les informations reçues que de les taper</em>)\n\t</li>\n</ul>\n\n</body>\n</html>\n";
示例15: decrypt
if ($_userid) {
$auth = '';
}
if ($auth) {
$auth = decrypt($auth, DT_KEY . 'LOGIN');
$_auth = explode('|', $auth);
if ($_auth[0] == 'LOGIN' && check_name($_auth[1]) && strlen($_auth[2]) >= $MOD['minpassword'] && $DT_TIME >= intval($_auth[3]) && $DT_TIME - intval($_auth[3]) < 30) {
$submit = 1;
$username = $_auth[1];
$password = $_auth[2];
$MOD['captcha_login'] = $captcha = 0;
}
}
$action = 'login';
if ($submit) {
captcha($captcha, $MOD['captcha_login']);
$username = trim($username);
$password = trim($password);
if (strlen($username) < 3) {
message($L['login_msg_username']);
}
if (strlen($password) < 5) {
message($L['login_msg_password']);
}
$goto = isset($goto) ? true : false;
if ($goto) {
$forward = $MOD['linkurl'];
}
$cookietime = isset($cookietime) ? 86400 * 30 : 0;
$api_msg = $api_url = '';
$option = isset($option) ? trim($option) : 'username';