Hi,

I want to insert a securityimage within a registrationform. Unfortunately the securityimage-scripts is putting out errors. Actualy I have the whole project that include also these scripts on my local host under /srv/www/htdocs/<projectdir>. What can be wrong because the script only says that it cant be displayed because there are errors in the script. What
errors that are not mentioned.

The database "Moneysql1" mentioned in the script is stored localy.

As Attachment the script.

Regards,
Ruprecht
<?
header ("Content-type: image/jpeg");

if (!isset($code)) {
  exit;
}

$host = "localhost";
//$user = "Moneysql1";
$user="root";
//$pass = "QaKkoMXq";
$pass = "";
$datenbank = "Moneysql1";

$verbindung = mysql_connect($host, $user, $pass) OR die ("Konnte keine Verbindung zur Datenbank herstellen!");
mysql_select_db($datenbank) OR die ("Konnte die Datenbank nicht auswaehlen!");

$im = imageCreateFromJPEG($_SERVER["DOCUMENT_ROOT"]."/images/secure_back2.jpg");

// Lösche alte Securecodes
$zualt = date("Y-m-d H:i:s",mktime(date("H"),date("i")-10,date("s"),date("m"),date("d"),date("Y")));
$res = mysql_query("DELETE FROM secure WHERE datum<'".$zualt."'");
// Jetzt hole den neuen

$res = mysql_query("SELECT * FROM secure WHERE secure1='".$code."'");
if (mysql_num_rows($res)<1) {
  exit;
}

$help = mysql_fetch_array($res);
$z = $help["secure2"];

$abstand = 20;
$zufall = array();
$gesamtbreite = 0;
for ($n=0;$n<strlen($z);$n++) {
  $zufall[$n] = array();
  $zufall[$n]["ziffer"] = substr($z,$n,1);

  //echo $_SERVER["DOCUMENT_ROOT"];
  $ausmasse = ImageTTFBBox(20,0,$_SERVER["DOCUMENT_ROOT"]."/ttf/arialbd.ttf",substr($z,$n,1));
  $zufall[$n]["hoehe"] = rand(0-$ausmasse[5],40);
  $zufall[$n]["breite"] = $ausmasse[4];
  $gesamtbreite += $ausmasse[4];
}
// Zähle den Abstand dazu
$gesamtbreite += (strlen($z)-1)*$abstand;

$breite = (250-$gesamtbreite)/2;
$black = ImageColorAllocate ($im, 0, 0, 0);

// Und jetzt setze jede einzelne Ziffer in das Bild ein

for ($n=0;$n<strlen($z);$n++) {
  ImageTTFText ($im, 20, 0, $breite, $zufall[$n]["hoehe"], $black, $_SERVER["DOCUMENT_ROOT"]."/ttf/arialbd.ttf", $zufall[$n]["ziffer"]);
  $breite += $abstand;
  $breite += $zufall[$n]["breite"];
}

ImageJpeg ($im);
 ImageDestroy ($im);
?> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to