Foros del Web » Programación para mayores de 30 ;) » Programación General »

Captcha

Estas en el tema de Captcha en el foro de Programación General en Foros del Web. Hola! Estoy iniciando en el uso de perl. Estoy tratando de incluir en mi aplicación el uso de captcha mediante perl. Podrian ayudarme a decifrar ...
  #1 (permalink)  
Antiguo 03/09/2008, 07:36
 
Fecha de Ingreso: septiembre-2008
Mensajes: 3
Antigüedad: 15 años, 8 meses
Puntos: 0
Captcha

Hola!
Estoy iniciando en el uso de perl. Estoy tratando de incluir en mi aplicación el uso de captcha mediante perl. Podrian ayudarme a decifrar este error. !!!
Tome como ejemplo el siguiente código. Donde se debe incluir los directorios correspondientes para imagenes, db, etc. Sin embargo, al ejecutarlo de la siguiente manera http://localhost/perl/captcha.pl

presenta el siguiente mensaje

Error message:
Can't open File: \http\folder\d41d8cd98f00b204e9800998ecf8427e.png ,


Código usado:

use Authen::Captcha;

# create a new object
my $captcha = Authen::Captcha->new();

# set the data_folder. contains flatfile db to maintain state
$captcha->data_folder('/some/folder');

# set directory to hold publicly accessable images
$captcha->output_folder('/http/folder');

# Alternitively, any of the methods to set variables may also be
# used directly in the constructor

my $captcha = Authen::Captcha->new(
data_folder => 'some/folder',
output_folder => '/http/folder',
);

# create a captcha. Image filename is "$md5sum.png"
my $md5sum = $captcha->generate_code($number_of_characters);

# check for a valid submitted captcha
# $code is the submitted letter combination guess from the user
# $md5sum is the submitted md5sum from the user (that we gave them)
my $results = $captcha->check_code($code,$md5sum);
# $results will be one of:
# 1 : Passed
# 0 : Code not checked (file error)
# -1 : Failed: code expired
# -2 : Failed: invalid code (not in database)
# -3 : Failed: invalid code (code does not match crypt)
##############
  #2 (permalink)  
Antiguo 03/09/2008, 08:20
Avatar de monoswim
$moderador{'Esteban'}
 
Fecha de Ingreso: febrero-2002
Ubicación: Buenos Aires - Argentina
Mensajes: 8.762
Antigüedad: 22 años, 3 meses
Puntos: 90
Respuesta: Captcha

output_folder => '/http/folder',

ahí deberías de colocar http://localhost/folder/

donde folder es el directorio de tus imágenes...

Saludos
__________________
Esteban Quintana
  #3 (permalink)  
Antiguo 03/09/2008, 08:52
 
Fecha de Ingreso: septiembre-2008
Mensajes: 3
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Captcha

Hola

Inclui la recomendacion en el codigo y obtengo el siguiente mensaje.



Error message:
Can't open File: http:\localhost\xampp\modperl\some\http\folder\d41 d8cd98f00b204e9800998ecf8427e.png ,




use Authen::Captcha;

# create a new object
my $captcha = Authen::Captcha->new();

# set the data_folder. contains flatfile db to maintain state
$captcha->data_folder('http://localhost/modperl/some/folder/');

# set directory to hold publicly accessable images
$captcha->output_folder('http://localhost/modperl/some/http/folder/');

# Alternitively, any of the methods to set variables may also be
# used directly in the constructor

my $captcha = Authen::Captcha->new(
data_folder => 'http://localhost/modperl/some/folder/',
output_folder => 'http://localhost/modperl/some/http/folder/',
);

# create a captcha. Image filename is "$md5sum.png"
my $md5sum = $captcha->generate_code($number_of_characters);

# check for a valid submitted captcha
# $code is the submitted letter combination guess from the user
# $md5sum is the submitted md5sum from the user (that we gave them)
my $results = $captcha->check_code($code,$md5sum);
# $results will be one of:
# 1 : Passed
# 0 : Code not checked (file error)
# -1 : Failed: code expired
# -2 : Failed: invalid code (not in database)
# -3 : Failed: invalid code (code does not match crypt)
##############
  #4 (permalink)  
Antiguo 03/09/2008, 11:01
Avatar de monoswim
$moderador{'Esteban'}
 
Fecha de Ingreso: febrero-2002
Ubicación: Buenos Aires - Argentina
Mensajes: 8.762
Antigüedad: 22 años, 3 meses
Puntos: 90
Respuesta: Captcha

Estuve viendo la documentación del módulo

http://search.cpan.org/~unrtst/Authe...023/Captcha.pm

y estaba bien, debes hacerlo sin localhost...pero debe ser la dirección real del directorio

Al parecer las direcciones son absolutas, si colocas /http/folder debe estar en el drectorio raiz...

Seguramente debas usar algo como /home/nombreusuario/public_html/imagenes

Espero que te sirva

Saludos
__________________
Esteban Quintana
  #5 (permalink)  
Antiguo 03/09/2008, 12:37
 
Fecha de Ingreso: septiembre-2008
Mensajes: 3
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Captcha

Hola: Aplique el cambio en codigo de esta manera y ahora lo que se me presenta es una pagina en blanco. Los folderes estan creados en mi disco C.

Alguna idea? Gracias


use Authen::Captcha;

# create a new object
my $captcha = Authen::Captcha->new();

# set the data_folder. contains flatfile db to maintain state
$captcha->data_folder('C:/some/folder/');

# set directory to hold publicly accessable images
$captcha->output_folder('C:/some/http/folder/');

# Alternitively, any of the methods to set variables may also be
# used directly in the constructor

my $captcha = Authen::Captcha->new(
data_folder => 'C:/some/folder/',
output_folder => 'C:/some/http/folder/',
);

# create a captcha. Image filename is "$md5sum.png"
my $md5sum = $captcha->generate_code($number_of_characters);

# check for a valid submitted captcha
# $code is the submitted letter combination guess from the user
# $md5sum is the submitted md5sum from the user (that we gave them)
my $results = $captcha->check_code($code,$md5sum);
# $results will be one of:
# 1 : Passed
# 0 : Code not checked (file error)
# -1 : Failed: code expired
# -2 : Failed: invalid code (not in database)
# -3 : Failed: invalid code (code does not match crypt)
##############
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:31.