473,410 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

capcha

232 100+
i m very new to capcha.i downloaded simple capcha file but capcha image is not shown in the form .i cannot find what changes should i do so that capcha image show in the form
form.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. ?>
  4. <HTML>
  5. <HEAD>
  6. <TITLE>PHP-CAPTCHA </TITLE>
  7. <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">
  8. </HEAD>
  9. <BODY onLoad="return focuson();">
  10. <script   language="javascript">
  11. function focuson()
  12.   { document.form1.number.focus()}
  13.  
  14. function check()
  15.     {
  16.     if(document.form1.number.value==0)
  17.         {
  18.         alert("Please enter your Category Name");
  19.         document.form1.number.focus();
  20.         return false;
  21.         }
  22.     }
  23.  
  24. </script>
  25. <?php
  26.  
  27.    if(isset($_REQUEST['Submit'])){
  28.       $key=substr($_SESSION['key'],0,5);
  29.       $number = $_REQUEST['number'];
  30.       if($number!=$key){
  31.           echo '<center><font face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
  32.            Validation string not valid! Please try again!</font></center>';}
  33.       else{
  34.            echo '<center><font face="Verdana, Arial, Helvetica, sans-serif"  color="#66CC00">
  35.             Your string is valid!</font></center>';} 
  36.      }
  37. ?>
  38. <form name="form1" method="post" action="form.php"   onSubmit="return check();">
  39. <table width="342" align="center" cellspacing="0" bgcolor="#D4D0C8">
  40. <tr>
  41.   <td colspan="4" align="center"><hr></td>
  42.   </tr>
  43. <tr>
  44.   <td width="8" align="center">&nbsp;</td>
  45.   <td width="330" align="right" valign="top">&nbsp;</td>
  46.   <td width="330" align="right" valign="top">&nbsp;</td>
  47.   <td width="2" align="center">&nbsp;</td>
  48. </tr>
  49. <tr>
  50.   <td align="center">&nbsp;</td>
  51.   <td align="right" valign="top">&nbsp;</td>
  52.   <td align="right" valign="top">&nbsp;</td>
  53.   <td align="center">&nbsp;</td>
  54. </tr> 
  55.  
  56. <tr>
  57.   <td align="center">&nbsp;</td>
  58.   <td align="center">&nbsp;</td>
  59.   <td align="center"><img src="php_captcha.php"></td>
  60.   <td align="center">&nbsp;</td>
  61. </tr>
  62. <tr>
  63.   <td align="center">&nbsp;</td>
  64.   <td align="center">&nbsp;</td>
  65.   <td align="center">&nbsp;</td>
  66.   <td align="center">&nbsp;</td>
  67. </tr>
  68. <tr>
  69.   <td align="center">&nbsp;</td>
  70.   <td align="center"> Please enter the string shown in the image in the form.<br></td>
  71.   <td align="center"><input name="number" type="text" id="number"></td>
  72.   <td align="center">&nbsp;</td>
  73. </tr>
  74. <tr>
  75.   <td align="center">&nbsp;</td>
  76.   <td align="center">&nbsp;</td>
  77.   <td align="center">&nbsp;</td>
  78.   <td align="center">&nbsp;</td>
  79. </tr>
  80. <tr>
  81.   <td align="center">&nbsp;</td>
  82.   <td align="center">&nbsp;</td>
  83.   <td align="center"><input name="Submit" type="submit"   value="Submit"></td>
  84.   <td align="center">&nbsp;</td>
  85. </tr>
  86. <tr>
  87.   <td colspan="4" align="center"><hr></td>
  88.   </tr>
  89. </table>
  90. </form>
  91. </BODY>
  92. </HTML>
php_capcha.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3.  
  4. $RandomStr = md5(microtime());// md5 to generate the random string
  5.  
  6. $ResultStr = substr($RandomStr,0,5);//trim 5 digit 
  7.  
  8. $NewImage =imagecreatefromjpeg("img.jpg");//image create by existing image and as back ground 
  9.  
  10. $LineColor = imagecolorallocate($NewImage,233,239,239);//line color 
  11. $TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white
  12.  
  13. imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image 
  14. imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image 
  15.  
  16. imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);// Draw a random string horizontally 
  17.  
  18. $_SESSION['key'] = $ResultStr;// carry the data through session
  19.  
  20. header("Content-type: image/jpeg");// out out the image 
  21.  
  22. imagejpeg($NewImage);//Output image to browser 
  23.  
  24. ?>
  25.  
  26.  
Feb 24 '10 #1
2 1623
dlite922
1,584 Expert 1GB
is php error messaging turned on? do you get any errors?

is GD installed?



Dan
Feb 24 '10 #2
kkshansid
232 100+
There is no error only captcha image not show on browser
what is gd?
Feb 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: William Tasso | last post by:
Gretings One and All Any idea how I can make a graphic on-the-fly containing graphical implementation of letters and numbers (like a capcha for example) in dotnet? If it makes a difference...
11
by: Prince of Code | last post by:
Hey There, I have been to this group for a couple of days. I am really impressed by the way people respond. I get answers for all my doubts and that too more info. So I am putting across a doubt...
4
by: Mike Owen | last post by:
Hi, I am just about to write a registration screen for a web based application. I have seen and used registration screens that show the user a graphic containing randon text that they are asked...
0
by: millw0rm | last post by:
I am about to implement an authentication system on the site I am building. Basic feature i need are 1. Email authentication 2. Capcha verification 3. Session management 4. Redirect (If user...
8
RedSon
by: RedSon | last post by:
Dang this free hosting site. They made it so I can't use fsockopen, which normally I wouldn't care about but I want to be able to use some anti spam type software like captcha and akismet. They said...
5
by: nightcats | last post by:
Hi, I try to put a very basic Capcha system in my forum. I've already figure out how to randonly generate a combination: <? function Pass($i=8) { srand((double)microtime()*1000000); return...
13
by: Ben Bacarisse | last post by:
A while back I suggested a method of using timestamps to filter out at least some automatic form postings. Now that I have tried it for about 10 months, I thought it might useful to report back. ...
3
by: KDawg44 | last post by:
Hi, I would like a verification image for new sign ups on a website. Is there a way to call the PHP script through an AJAX call and have the image passed back and then display? Is there a way...
28
by: William Gill | last post by:
I am getting a lot of phony form submissions. I assume they are not being done manually because of the volume, but by some sort of spam-bot. I thought of putting some code in the php processing...
15
by: sb5309 | last post by:
When one uses CAPTCHA (form with verification code), a session is required to keep the session data. In examples that I have seen on the net, I did not see a session is closed after use. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.