本文整理汇总了PHP中Captcha类的典型用法代码示例。如果您正苦于以下问题:PHP Captcha类的具体用法?PHP Captcha怎么用?PHP Captcha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Captcha类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Check if the Captcha result is good
* @return Mixed
*/
public function send()
{
$session = new SessionCaptcha();
$captcha = new Captcha($session);
$frontendData = $captcha->getFrontendData();
if (!$frontendData) {
return Lang::get('error.captcha.none');
} else {
// If an image field name was submitted, try to validate it
if ($imageAnswer = Input::get($frontendData['imageFieldName'])) {
if ($captcha->validateImage($imageAnswer)) {
// Return false if the result is correct
return false;
} else {
return Lang::get('error.captcha.image');
}
} else {
if ($audioAnswer = Input::get($frontendData['audioFieldName'])) {
if ($captcha->validateAudio($audioAnswer)) {
// Return false if the result is correct
return false;
} else {
return Lang::get('error.captcha.audio');
}
} else {
return Lang::get('error.captcha.incomplete');
}
}
}
}
示例2: check
/**
* Vérifie un email
* @return object 2 attributs, bool success et array string msg
*/
private function check()
{
$std = (object) array('success' => false, 'msg' => array());
if (!$_SESSION['user']) {
if (($res = Membre::checkPseudo($this->pseudo)) !== true) {
$std->msg[] = $res;
}
if (($res = Membre::checkEmail($this->email)) !== true) {
$std->msg[] = $res;
}
$captcha = new Captcha();
if (($res = $captcha->check($this->captcha)) !== true) {
$std->msg[] = $res;
}
}
if (($res = $this->checkSujet($this->sujet)) !== true) {
$std->msg[] = $res;
}
if (($res = $this->checkMessage($this->message)) !== true) {
$std->msg[] = $res;
}
if (empty($std->msg)) {
$std->success = true;
}
return $std;
}
示例3: generate_overview
function generate_overview($filecats = '', $offset = '', $subcatID = 0)
{
global $_language;
$rubrics = safe_query("SELECT * FROM " . PREFIX . "files_categorys WHERE subcatID = '" . $subcatID . "' ORDER BY name");
$i = 1;
$CAPCLASS = new Captcha();
$CAPCLASS->create_transaction();
$hash = $CAPCLASS->get_hash();
while ($ds = mysql_fetch_array($rubrics)) {
if ($i % 2) {
$td = 'td1';
} else {
$td = 'td2';
}
$filecats .= '<tr>
<td class="' . $td . '">' . $offset . getinput($ds['name']) . '</td>
<td class="' . $td . '" align="center"><input type="button" onclick="MM_goToURL(\'parent\',\'admincenter.php?site=filecategorys&action=edit&filecatID=' . $ds['filecatID'] . '\');return document.MM_returnValue" value="' . $_language->module['edit'] . '" />
<input type="button" onclick="MM_confirm(\'' . $_language->module['really_delete'] . '\', \'admincenter.php?site=filecategorys&delete=true&filecatID=' . $ds['filecatID'] . '&captcha_hash=' . $hash . '\')" value="' . $_language->module['delete'] . '" /></td>
</tr>';
$i++;
if (mysql_num_rows(safe_query("SELECT * FROM " . PREFIX . "files_categorys WHERE subcatID = '" . $ds['filecatID'] . "'"))) {
$filecats .= generate_overview("", $offset . getinput($ds['name']) . " » ", $ds['filecatID']);
}
}
return $filecats;
}
示例4: image
/**
* @param $session
*/
function image($session)
{
App::import('Vendor', 'Captcha', array('file' => 'captcha' . DS . 'captcha.php'));
$captcha = new Captcha();
$captcha->session_var = $this->sessionName . $session;
$captcha->CreateImage();
}
示例5: auth
function auth()
{
if (!valid('janitor_board')) {
// Admin.php login
$temp = "" . "<div align='center' vertical-align='middle'>" . ($temp = '<form action="' . PHP_ASELF . '" method="post"><table>' . '<tr><td>Username</td><td><input type="text" name="usernm" style="width:100%" /></td></tr>' . '<tr><td>Password</td><td><input type="password" name="passwd" style="width:100%" /></td></tr>');
if (SECURE_LOGIN) {
if (RECAPTCHA) {
$temp .= "<tr><td colspan='2'><script src='//www.google.com/recaptcha/api.js'></script><div class='g-recaptcha' data-sitekey='" . RECAPTCHA_SITEKEY . "'></td></tr>";
} else {
$temp .= "<tr><td><img src='" . CORE_DIR_PUBLIC . "/general/captcha.php' /></td><td><input type='text' name='num' size='20' placeholder='Captcha'></td></tr>";
}
}
$temp .= "<tr><td colspan='2'><input type='submit' value='" . S_MANASUB . "'></td></tr></table>" . "<br></form></div>";
echo $temp;
if (isset($_POST['usernm']) && isset($_POST['passwd'])) {
if (SECURE_LOGIN) {
require_once CORE_DIR . '/general/captcha.php';
$captcha = new Captcha();
if ($captcha->isValid() !== true) {
$this->error(S_CAPFAIL);
}
}
$this->doLogin($_POST['usernm'], $_POST['passwd']);
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=" . PHP_ASELF_ABS . "\">";
}
die("</body></html>");
}
return $temp;
}
示例6: captcha
public function captcha()
{
$this->load->library('captcha');
$captcha = new Captcha();
$this->session->data['captcha'] = $captcha->getCode();
$captcha->showImage();
}
示例7: captcha
public function captcha(){
//获取验证码
$captcha = new Captcha();
//修改响应头
header('Content-type:image/png');
$captcha->generate();
}
示例8: captcha
/**
* Genera Img Captcha
*
*/
public function captcha()
{
Load::lib('captcha/captcha');
View::select(NULL, NULL);
$captcha = new Captcha();
$captcha->run();
}
示例9: index
public function index()
{
$c = new Captcha();
$c->doimg();
$code = $c->getCode();
session("myf_code", $code);
}
示例10: captcha
public function captcha()
{
$this->load->library("captcha");
$captcha = new Captcha();
$captcha->size = 6;
$captcha->session = "captcha";
$captcha->display();
}
示例11: generateCaptcha
public function generateCaptcha()
{
require_once '../core/Captcha.php';
$cap = new Captcha();
$src = $cap->draw_captcha();
$time = $cap->time;
print $time . '#' . $src;
}
示例12: checkRegistrationAndActualCountryAfterFailedLogin
public function checkRegistrationAndActualCountryAfterFailedLogin(Captcha $captcha, User $user, $loginCountry)
{
$registrationCountry = $user->getRegistrationCountry();
if ($registrationCountry != $loginCountry) {
$captcha->setCaptchaStatus(true);
}
return $captcha->getCaptchaStatus();
}
示例13: captcha
function captcha($pattern, $left, $operator, $right)
{
if ($pattern < 1 or $pattern > 2 or ($operator < 1 or $operator > 3)) {
return "You shouldn't do this to me :(" . "\n";
}
$captcha = new Captcha($pattern, $left, $operator, $right);
return $captcha->toString();
}
示例14: buildCaptcha
function buildCaptcha()
{
$pattern = $this->randomizer->pattern();
$left = $this->randomizer->operand();
$operator = $this->randomizer->operator();
$right = $this->randomizer->operand();
$captcha = new Captcha($pattern, $left, $operator, $right);
return $captcha->toString();
}
示例15: getCaptcha
public function getCaptcha()
{
$width = Input::get('w', 100);
$height = Input::get('h', 25);
$letters = Input::get('letters', 4);
$cpa = new Captcha($width, $height, $letters);
header("Content-Type: image/png");
return $cpa->createImage();
}