Ya gracias a ustedes y a los tutoriales pude pasar todo a mysql y funciona perfectamente.
Me faltan pequeños detalles, probar todo y les pasaré la web una ves finalizada.
Les comento, tengo un problema con el Capcha desde que mudé la web
a HostGator, el error Completo dice esto al ejecutar el php que genera la imagen:
Cita:
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imageconvolution() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 74
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 77
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 83
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64
Warning: imageconvolution() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 74
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 77
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 83
Uno de los Errores que destaco es:
Cita:
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 77
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82
Por lo que tengo entendido, no puede cambiar la información del Head.
Esté es el codigo completo para el que lo quiera usar:
Código PHP:
#create image and set background color
$captcha = imagecreatetruecolor(120,35);
$background_color = imagecolorallocate($captcha, 255, 255, 255);
imagefill($captcha, 0, 0, $background_color);
#generate a random string of 5 characters
$string = substr(md5(rand()*time()),0,5);
#make string uppercase and replace "O" and "0" to avoid mistakes
$string = strtoupper($string);
$string = str_replace("O","B", $string);
$string = str_replace("0","C", $string);
#save string in session "captcha" key
session_start();
$_SESSION["captcha"]=$string;
#place each character in a random position
$font = 'arial.ttf';
for($i=0;$i<5;$i++){
$color = rand(0,32);
if(file_exists($font)){
$x=4+$i*23+rand(0,6);
$y=rand(18,28);
imagettftext ($captcha, 15, rand(-25,25), $x, $y, imagecolorallocate($captcha, $color, $color, $color), $font, $string[$i]);
}else{
$x=5+$i*24+rand(0,6);
$y=rand(1,18);
imagestring($captcha, 5, $x, $y, $string[$i], imagecolorallocate($captcha, $color, $color, $color));
}
}
#applies distorsion to image
$matrix = array(array(1, 1, 1), array(1.0, 7, 1.0), array(1, 1, 1));
imageconvolution($captcha, $matrix, 16, 32);
#avoids catching
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
#return the image
header("Content-type: image/gif");
imagejpeg($captcha);
Código PHP:
#avoids catching
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
#return the image
header("Content-type: image/gif");
imagejpeg($captcha);
Veo veo y veo el código y no entiendo cual es el problema, alguien me podria explicar porfavor?
Gracias.