Edición de «Captcha en KumbiaPHP»
De KumbiaPHP Framework Wiki
Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces guarda los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 1: | Línea 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Captcha es el acrónimo de Completely Automated Public Turing test to tell Computers and Humans Apart (Prueba de Turing pública y automática para diferenciar máquinas y humanos). | Captcha es el acrónimo de Completely Automated Public Turing test to tell Computers and Humans Apart (Prueba de Turing pública y automática para diferenciar máquinas y humanos). | ||
Línea 80: | Línea 75: | ||
class ContactosController extends ApplicationController { | class ContactosController extends ApplicationController { | ||
− | public | + | public form(){ |
} | } | ||
− | public | + | public formresponse(){ |
} | } | ||
Línea 122: | Línea 117: | ||
'''ahora en nuestra vista''' | '''ahora en nuestra vista''' | ||
− | form. | + | form.php |
<source lang=php > | <source lang=php > | ||
− | <?php | + | <?php echo form_tag('contactos/formresponse', 'method: post' ); ?> |
− | |||
− | |||
− | ?> | ||
− | |||
− | |||
− | |||
<a tabindex="-1" style="border-style: none" href="#" title="Refresh Image" | <a tabindex="-1" style="border-style: none" href="#" title="Refresh Image" | ||
onClick="document.getElementById('captcha').src = '<?php echo URL_PATH . "contactos/captcha/" ?>'+ Math.random(); return false"> | onClick="document.getElementById('captcha').src = '<?php echo URL_PATH . "contactos/captcha/" ?>'+ Math.random(); return false"> | ||
Línea 141: | Línea 130: | ||
?> | ?> | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
'''un archivo "refresh.gif" debe estar en public/img/''' | '''un archivo "refresh.gif" debe estar en public/img/''' | ||
Línea 158: | Línea 144: | ||
.. | .. | ||
. | . | ||
− | public | + | public formresponse(){ |
if ( $this->has_post('code') ){ | if ( $this->has_post('code') ){ | ||
Línea 168: | Línea 154: | ||
$valid = $img->check( $this->post('code') ); | $valid = $img->check( $this->post('code') ); | ||
− | if($valid == true) | + | if($valid == true) Flash::error("captcha valido"); |
− | + | else Flash::error("captcha invalido!"); | |
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
Línea 183: | Línea 166: | ||
class ContactosController extends ApplicationController { | class ContactosController extends ApplicationController { | ||
− | public | + | public form(){ |
} | } | ||
− | public | + | public formresponse(){ |
if ( $this->has_post('code') ){ | if ( $this->has_post('code') ){ | ||
/* verificamos si se mando form y si dentro del $_POST esta un campo llamado code | /* verificamos si se mando form y si dentro del $_POST esta un campo llamado code | ||
Línea 195: | Línea 178: | ||
$valid = $img->check( $this->post('code') ); | $valid = $img->check( $this->post('code') ); | ||
− | if($valid == true) | + | if($valid == true) Flash::error("captcha valido"); |
− | + | ||
− | + | else Flash::error("captcha invalido!"); | |
− | |||
− | |||
} | } | ||
} | } | ||
Línea 219: | Línea 200: | ||
</source> | </source> | ||
− | la vista form. | + | la vista form.php |
<source lang=php > | <source lang=php > | ||
− | <?php | + | <?php echo form_tag('contactos/formresponse', 'method: post' ); ?> |
− | |||
− | |||
− | ? | ||
− | |||
<a tabindex="-1" style="border-style: none" href="#" title="Refresh Image" | <a tabindex="-1" style="border-style: none" href="#" title="Refresh Image" | ||
onClick="document.getElementById('captcha').src = '<?php echo URL_PATH . "contactos/captcha/" ?>'+ Math.random(); return false"> | onClick="document.getElementById('captcha').src = '<?php echo URL_PATH . "contactos/captcha/" ?>'+ Math.random(); return false"> | ||
Línea 240: | Línea 217: | ||
JIM | JIM | ||
− | |||
− |