Problems in creating image
am 05.02.2006 10:45:34 von Ruprecht Helms--------------050400010605080301030905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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/
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
--------------050400010605080301030905
Content-Type: text/x-sql;
name="secureimage.php"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="secureimage.php"
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/secur e_back2.jpg");
// Lösche alte Securecodes
$zualt = date("Y-m-d H:i:s",mktime(date("H"),date("i")-10,date("s"),date("m"),dat e("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
$zufall[$n]["ziffer"] = substr($z,$n,1);
//echo $_SERVER["DOCUMENT_ROOT"];
$ausmasse = ImageTTFBBox(20,0,$_SERVER["DOCUMENT_ROOT"]."/ttf/arialbd.tt f",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
$breite += $abstand;
$breite += $zufall[$n]["breite"];
}
ImageJpeg ($im);
ImageDestroy ($im);
?>
--------------050400010605080301030905
Content-Type: text/plain; charset=us-ascii
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------050400010605080301030905--