Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2006, 15:39
Avatar de urgido
urgido
 
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 2 meses
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!