anushka Posted February 28, 2008 Share Posted February 28, 2008 Hello i want to create an image authentication whenever the user register in my page.i have done it but image is not displaying.i am using PHP 5.0 ,but there is no GD files in my phpinf folder can any one tel how to create it Thanks In advance Quote Link to comment Share on other sites More sharing options...
awpti Posted February 28, 2008 Share Posted February 28, 2008 Your question is vague and lacks any useful information. Are you saying there is no gd.so/php_gd.dll? Are you getting an error from the script? Details, man. Details. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted February 28, 2008 Share Posted February 28, 2008 if you say you've done it but its not working, post some code. maybe someone can look it over and see why its not working ??? Quote Link to comment Share on other sites More sharing options...
anushka Posted February 28, 2008 Author Share Posted February 28, 2008 <?php // ... the login script is up here //session_start(); ?> <html> <head> <title>Basic Login</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if ($errorMessage != '') { ?> <p align="center"><strong><font color="#990000"><?php echo $errorMessage; ?></font></strong></p> <?php } ?> <form action="" method="post" name="frmLogin" id="frmLogin"> <table width="500" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="150">User Id</td> <td><input name="txtUserId" type="text" id="txtUserId"></td> </tr> <tr> <td width="150">Password</td> <td><input name="txtPassword" type="password" id="txtPassword"></td> </tr> <tr> <td width="150">Enter Number</td> <td><input name="txtNumber" type="text" id="txtNumber" value=""> <img src="randomImage.php"></td> </tr> <tr> <td width="150"> </td> <td><input name="btnLogin" type="submit" id="btnLogin" value="Login"></td> </tr> </table> </form> </body> </html> dis is my login form named has login.php randomImage.php <?php session_start(); // generate 5 digit random number $rand = rand(10000, 99999); echo hello; // create the hash for the random number and put it in the session $_SESSION['image_random_value'] = md5($rand); // create the image $image =imagecreate(60, 30) or die("couldnot create image"); // use white as the background image $bgColor = imagecolorallocate ($image, 255, 255, 255); // the text color is black $textColor = imagecolorallocate ($image, 0, 0, 0); // write the random number imagestring ($image, 5, 5, 8, $rand, $textColor); // send several headers to make sure the image is not cached // taken directly from the PHP Manual // Date in the past header("Expires: Mon, 26 Jul 2020 05:00:00 GMT"); // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); // send the content type header so the image is displayed properly header('Content-type: image/jpeg'); // send the image to the browser imagejpeg($image); // destroy the image to free up the memory imagedestroy($image); ?> These are the two pages .when i compile i am not able to display the Random image Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted February 28, 2008 Share Posted February 28, 2008 Is GD installed? <?php php info(); (remove the space) ?> Run the above and see what it says about GD. If it's not installed, look in your php.ini Quote Link to comment Share on other sites More sharing options...
anushka Posted February 28, 2008 Author Share Posted February 28, 2008 GD is not installed i have gone through php.ini file.But i am not having GD .dll file in that php.ini, but i am having gd2.dll file .Is gd .dll file is same has gd2.dll file .Were Can i get that GD File Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted February 28, 2008 Share Posted February 28, 2008 The php.ini should look like this: extension=php_gd2.dll Run this and see what happens <?php var_dump(gd_info()); ?> Quote Link to comment Share on other sites More sharing options...
anushka Posted February 28, 2008 Author Share Posted February 28, 2008 This the error which i got when i executed Call to undefined function gd_info() .I have also removed the semicolons in php.ini file for extension=php_gd2.dll Thanks for helping Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.