Esempio n. 1
0
 $txtPassword2 = P("txtPassword2");
 $reCaptcha1 = P("reCaptcha1");
 $reCaptcha2 = P("reCaptcha2");
 if (!validateEmail($txtEmail)) {
     array_push($errmsg, "รูปแบบ email ไม่ถูกต้อง");
 }
 if (strlen($txtPassword1) == 0) {
     array_push($errmsg, "กรุณาใส่รหัสผ่าน");
 }
 if ($txtPassword1 !== $txtPassword2) {
     array_push($errmsg, "รหัสผ่านไม่ตรงกัน");
 }
 if (strlen($reCaptcha2) == 0) {
     array_push($errmsg, "ยืนยันว่าคุณไม่ใช่โปรแกรมอัตโนมัติ");
 } else {
     $reCap = getCAP($reCaptcha1);
     if ($reCaptcha2 != $reCap[2]) {
         array_push($errmsg, "ยืนยันตัวตนล้มเหลว คุณอาจจะเป็นโปรแกรมอัตโนมัติ กรุณายืนยันใหม่");
     }
 }
 // no error then save
 if (count($errmsg) == 0) {
     $user = new Users();
     $user->email = $txtEmail;
     $user->pwd = $txtPassword1;
     $user->avt = "/img/avt/m" . rand(0, 7) . ".png";
     $res = $user->CreateUser();
     if ($res == -1) {
         array_push($errmsg, "อีเมลล์ {$txtEmail} ถูกใช้ไปแล้ว");
     } else {
         array_push($sucmsg, "ลงทะเบียนเสร็จสมบูรณ์ กรุณายืนยันตัวตน ผ่าน Email");
Esempio n. 2
0
<?php

include "conn.php";
$cap = G("cap");
$str = "" . getCAP($cap)[0] . " + " . getCAP($cap)[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);