|
Posted by Marek Kilimajer on 10/21/86 11:16
Rahul S. Johari wrote:
> Ave,
>
> A simple Image Verification script is working perfect in IE on Windows...
> But isn¹t working in Safari on Mac OS X! It displays a blank page instead of
> the image with the form. Here¹ s the Script:
>
> <?
> header("Content-Type: image/png");
Because only Safari gets it right. With the above line you are saing
this html page is a PNG image. The png file is saved, not output. Remove
the line.
BTW, you might not be concerned about it much, but you have a race
condition in your script.
> session_start();
> $new_string;
> session_register('new_string');
> ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <HTML>
> <HEAD>
> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <TITLE>Verification : IMSAFM</TITLE>
> </HEAD>
> <BODY>
> <?php
> $im = ImageCreate(200, 40);
>
> $white = ImageColorAllocate($im, 255, 255, 255);
> $black = ImageColorAllocate($im, 0, 0, 0);
>
> srand((double)microtime()*1000000);
> $string = md5(rand(0,9999));
> $new_string = substr($string, 17, 5);
> ImageFill($im, 0, 0, $black);
> ImageString($im, 4, 96, 19, $new_string, $white);
> ImagePNG($im, "verify.png");
> ImageDestroy($im);
> ?>
>
> <img src="verify.png" width="200" height="40"><br><br>
> Type the code you see in the image in the box below. (case sensitive)
> <form action="verified.php" method=post>
> <input name="random" type="text" value="">
> <input type="submit">
> </form>
> </BODY>
> </HTML>
>
> Any tips to make it work in Safari as well?
>
> Thanks,
>
> Rahul S. Johari
> Coordinator, Internet & Administration
> Informed Marketing Services Inc.
> 251 River Street
> Troy, NY 12180
>
> Tel: (518) 266-0909 x154
> Fax: (518) 266-0909
> Email: rahul@informed-sources.com
> http://www.informed-sources.com
>
>
[Back to original message]
|