Exemplo n.º 1
0
    $_SESSION['regis']["error"]["txtEmail"] = "กรุณากรอก Email";
} else {
    if (filter_var($txtEmail, FILTER_VALIDATE_EMAIL) === false) {
        $_SESSION['regis']["error"]["txtEmail"] = "Email ไม่ถูกต้อง";
    } else {
        $sql = "select count(*) cnt from usr where email = '{$txtEmail}'";
        $cnt = queryCnt($sql);
        if ($cnt > 0) {
            $_SESSION['regis']["error"]["txtEmail"] = "Email ถูกใช้ไปแล้ว";
        }
    }
}
if (empty($txtCapcha)) {
    $_SESSION['regis']["error"]["txtCapcha"] = "กรุณากรอกเพื่อระบุว่าคุณไม่ใช่หุ่นยนต์";
} else {
    if (intval($txtCapcha) != capcha($secret)[2]) {
        $_SESSION['regis']["error"]["txtCapcha"] = "กรุณากรอกตัวเลขที่ถูกต้อง";
    }
}
$_SESSION['regis']["txtEmail"] = $txtEmail;
if (count($_SESSION['regis']["error"]) > 0) {
    header("Location: /regis");
    exit;
}
//////////////////////// PASS
unset($_SESSION['regis']);
$sql = "insert into usr(email) values('{$txtEmail}')";
mysql_query($sql);
$sql = "select count(*) cnt from usr where email = '{$txtEmail}'";
$cnt = queryCnt($sql);
if ($cnt > 0) {
Exemplo n.º 2
0
<?php

include "../conf/conn.php";
$cap = G("cap");
$recap = capcha($cap);
$str = "" . $recap[0] . " + " . $recap[1] . " =";
$im = imagecreate(70, 15);
$bg = imagecolorallocate($im, 238, 238, 238);
$textcolor = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 0, 0, $str, $textcolor);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
Exemplo n.º 3
0
<?php 
} elseif (G('res') == "fail") {
    ?>

  <div class="regis-container row">
    <div class="col-xs-12">

      <h4 class="error"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> มีความผิดพลาดในระบบ (โปรดรอสักครู่) <br> หรือ <a href="/regis">กดที่นี่</a> เพื่อลองใหม่อีกครั้ง</h4>

    </div>
  </div>

<?php 
} else {
    $cap = capcha();
    $img = base64_encode(file_get_contents("http://" . SITE_DOMAIN . "/api/cap.php?cap={$cap}"));
    ?>

  <div class="regis-container row">
    <div id="frm-regis" class="col-xs-12">    
      <form method="post" action="/api/regis">
        <div class="form-group">
          <label for="txtEmail">อีเมลล์</label>
          <input type="email" class="form-control" id="txtEmail" name="txtEmail" placeholder="Email" value="">
        </div>
        <div class="form-group">
          <label for="">ตรวจสอบว่าคุณไม่ใช่หุ่นยนต์</label>
          <div class="input-group">
            <div class="input-group-addon"><?php 
    echo '<img src="data:image/png;base64,' . $img . '"/>';
Exemplo n.º 4
0
    if (!$apiKey) {
        echo 'api key absent';
        exit;
    }
    if ($apiKey != $app->config('apikey')) {
        echo 'api key error';
        exit;
    }
}
$app->get('/api/get', function () {
    $app->response->write('********');
    return;
});
$app->get('/api/capcha/', function () use($app) {
    require 'capcha.php';
    capcha($app->config('salt'));
    exit;
});
$app->post('/api/check', function () use($app) {
    if ($_SESSION['count'] === md5($app->request->post('code') . $app->config('salt'))) {
        $app->response->write("OK");
    } else {
        $app->response->redirect('/api/info');
    }
});
$app->get('/api/info', function () {
    $template = <<<EOT
        <h2>rooot akalend </h2>
            <section style="padding-bottom: 20px">
                <h2>name</h2>
                <p>
Exemplo n.º 5
0
<?php

session_start();
function capcha($length)
{
    global $key;
    $dato = "0123456789abcdefghijklmnopqrstuvxyz";
    for ($i = 0; $i < $length; $i++) {
        $key .= $dato[rand(0, 34)];
    }
    return $key;
}
$_SESSION['texto'] = capcha(5);
$foto = imagecreatefromgif("../recursos/image6.gif");
$negro = imagecolorallocate($foto, 120, 120, 120);
$rojo = imagecolorallocate($foto, 220, 12, 20);
//$rgb[0] = rand(0,255);
//$rgb[1] = rand(0,255);
//$rgb[2] = rand(0,255);
//$colorAleatorioInvertido = imagecolorallocate($foto, 255-$rgb[0], 255-$rgb[1], 255-$rgb[2]);
for ($j = 0; $j <= 220; $j = $j + 15) {
    imageline($foto, $a = rand(0, 220), 0, $j, 50, $negro);
    imageline($foto, 0, $j - 6, 220, $j - 6, $negro);
}
/*
for ($i = 0;$i <=1500; $i++) {
   $randx = rand(0,220);
   $randy = rand(0,50);
   imagesetpixel($foto, $randx, $randy, $colorAleatorioInvertido);
}*/
//Imagen, tamaño, ángulo, x, y, color, fuente, texto