Foros del Web » Programando para Internet » PHP »

imagen de seguridad

Estas en el tema de imagen de seguridad en el foro de PHP en Foros del Web. Código PHP: require_once( "config.php" ); // Generate Reference ID if (isset( $_GET [ "refid" ]) && !empty( $_GET [ "refid" ])) {     $referenceid  =  stripslashes ( $_GET [ "refid" ]); } else { ...
  #1 (permalink)  
Antiguo 26/03/2006, 15:39
Avatar de urgido  
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 1 mes
Puntos: 25
imagen de seguridad

Código PHP:
require_once("config.php");

// Generate Reference ID
if (isset($_GET["refid"]) && !empty($_GET["refid"])) {
   
$referenceid stripslashes($_GET["refid"]);
} else {
   
$referenceid md5(mktime()*rand());
}

// Select Font
$font "Century.ttf";

// Select random background image
$bgurl rand(13);*/
$im ImageCreateFromPNG("images/bg".$bgurl.".png"); // LINEA 27

//Generate the random string
$chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k",
"K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v",
"V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
$length 5;
$textstr "";
for (
$i=0$i<$length$i++) {
   
$textstr .= $chars[rand(0count($chars)-1)];
}

// Create random size, angle, and dark color
$size rand(1216);
$angle rand(-55);
$color ImageColorAllocate($imrand(0100), rand(0100), rand(0100));

// Determine text size, and use dimensions to generate x & y coordinates
$textsize imagettfbbox($size$angle$font$textstr);
$twidth abs($textsize[2]-$textsize[0]);
$theight abs($textsize[5]-$textsize[3]);
$x = (imagesx($im)/2)-($twidth/2)+(rand(-2020));
$y = (imagesy($im))-($theight/2);

// Add text to image
ImageTTFText($im$size$angle$x$y$color$font$textstr);

// Output PNG Image
header("Content-Type: image/png");
/*ImagePNG($im);*/

// Destroy the image to free memory
imagedestroy($im);

// Insert reference into database, and delete any old ones

// Create reference 
mysql_query("INSERT INTO $secure_image (insertdate, referenceid, hiddentext) VALUES (
now(), '"
.$referenceid."', '".$textstr."')");
// Delete references older than 1 day
mysql_query("DELETE FROM $secure_image WHERE insertdate < date_sub(now(), interval 1 day)");

// End Output
exit; 
El código de arriba es un script que me pasaron pero al ejecutarlo me da el siguiente error:

Fatal error: Call to undefined function: iimagecreatefrompng() ... on line 27


La linea 42 la que marcado arriba, espero me puedan ayudar saludos
__________________
Hospedaje Web al mejor costo!
  #2 (permalink)  
Antiguo 26/03/2006, 16:26
Avatar de turco_7  
Fecha de Ingreso: diciembre-2003
Ubicación: Córdoba, Argentina
Mensajes: 1.044
Antigüedad: 20 años, 4 meses
Puntos: 19
solo estoy interesado en el script ..
require_once("config.php");
Esta parte tambien es parte del script .. o lo agregaste vos ?

Otra cosa modificate esta linea .. saludos
$bgurl=rand(1,3);*/
__________________
Mi Blog http://turco7.blogspot.com
Usuario Linux : 404289
Mi última página: http://www.digitalservicecba.com.ar - Reparacion de camaras digitales!
  #3 (permalink)  
Antiguo 26/03/2006, 16:38
Avatar de urgido  
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 1 mes
Puntos: 25
config.php es por que manejo sql es un script para registrarse en un mini script d euna biblioteca lo de "*/" está de más aunque lo elimine sigue sin funcionar. Saludos
__________________
Hospedaje Web al mejor costo!
  #4 (permalink)  
Antiguo 26/03/2006, 16:45
 
Fecha de Ingreso: diciembre-2005
Mensajes: 165
Antigüedad: 18 años, 3 meses
Puntos: 4
El error es realmente este?

Fatal error: Call to undefined function: iimagecreatefrompng() ... on line 27
Si es asi, estas llamando a iimagecreatefrompng (con dos i al principio), cuando tendria que ser con una i (imagecreatefrompng)

O eso, o que tu server no tiene instalada la libreria GD
  #5 (permalink)  
Antiguo 26/03/2006, 19:18
Avatar de turco_7  
Fecha de Ingreso: diciembre-2003
Ubicación: Córdoba, Argentina
Mensajes: 1.044
Antigüedad: 20 años, 4 meses
Puntos: 19
mmm a mi me dio este error ..
Fatal error: Call to undefined function ImageCreateFromPNG() in g:\www\textimage.php on line 14
no sera que tengo que tener algunas librerias cargadas ?? saludos..
__________________
Mi Blog http://turco7.blogspot.com
Usuario Linux : 404289
Mi última página: http://www.digitalservicecba.com.ar - Reparacion de camaras digitales!
  #6 (permalink)  
Antiguo 27/03/2006, 05:56
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 8 meses
Puntos: 102
Cita:
Fatal error: Call to undefined function ImageCreateFromPNG() in g:\www\textimage.php on line 14
no sera que tengo que tener algunas librerias cargadas ??
Si estás utilizando supuestas funciones nativas de PHP y te dice que no esta defintida lo más probable es que sea así (después de haber descartado que no este mal escrita ).

Para el caso de esa función necesitas la libreria GD: www.php.net/gd

Has un php_info()
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
  #7 (permalink)  
Antiguo 27/03/2006, 10:16
 
Fecha de Ingreso: junio-2005
Ubicación: Madrid, España
Mensajes: 288
Antigüedad: 18 años, 9 meses
Puntos: 1
necesitais esa funcion os esta diciendo simplemente que no encuentra dicha funcion
  #8 (permalink)  
Antiguo 28/03/2006, 17:21
Avatar de urgido  
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 1 mes
Puntos: 25
yo uso cpanel y active GD y cuando le di el rpm find me dice que esta instalado y ejecutado ¿que pasa? :S

me sigue dando el mismo error en esta linea:

Cita:
// Determine text size, and use dimensions to generate x & y coordinates
$textsize = imagettfbbox($size, $angle, $font, $textstr);
__________________
Hospedaje Web al mejor costo!
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 14:22.