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 - <?php
-
session_start();
-
?>
-
<HTML>
-
<HEAD>
-
<TITLE>PHP-CAPTCHA </TITLE>
-
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">
-
</HEAD>
-
<BODY onLoad="return focuson();">
-
<script language="javascript">
-
function focuson()
-
{ document.form1.number.focus()}
-
-
function check()
-
{
-
if(document.form1.number.value==0)
-
{
-
alert("Please enter your Category Name");
-
document.form1.number.focus();
-
return false;
-
}
-
}
-
-
</script>
-
<?php
-
-
if(isset($_REQUEST['Submit'])){
-
$key=substr($_SESSION['key'],0,5);
-
$number = $_REQUEST['number'];
-
if($number!=$key){
-
echo '<center><font face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
-
Validation string not valid! Please try again!</font></center>';}
-
else{
-
echo '<center><font face="Verdana, Arial, Helvetica, sans-serif" color="#66CC00">
-
Your string is valid!</font></center>';}
-
}
-
?>
-
<form name="form1" method="post" action="form.php" onSubmit="return check();">
-
<table width="342" align="center" cellspacing="0" bgcolor="#D4D0C8">
-
<tr>
-
<td colspan="4" align="center"><hr></td>
-
</tr>
-
<tr>
-
<td width="8" align="center"> </td>
-
<td width="330" align="right" valign="top"> </td>
-
<td width="330" align="right" valign="top"> </td>
-
<td width="2" align="center"> </td>
-
</tr>
-
<tr>
-
<td align="center"> </td>
-
<td align="right" valign="top"> </td>
-
<td align="right" valign="top"> </td>
-
<td align="center"> </td>
-
</tr>
-
-
<tr>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"><img src="php_captcha.php"></td>
-
<td align="center"> </td>
-
</tr>
-
<tr>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
</tr>
-
<tr>
-
<td align="center"> </td>
-
<td align="center"> Please enter the string shown in the image in the form.<br></td>
-
<td align="center"><input name="number" type="text" id="number"></td>
-
<td align="center"> </td>
-
</tr>
-
<tr>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
</tr>
-
<tr>
-
<td align="center"> </td>
-
<td align="center"> </td>
-
<td align="center"><input name="Submit" type="submit" value="Submit"></td>
-
<td align="center"> </td>
-
</tr>
-
<tr>
-
<td colspan="4" align="center"><hr></td>
-
</tr>
-
</table>
-
</form>
-
</BODY>
-
</HTML>
php_capcha.php - <?php
-
session_start();
-
-
$RandomStr = md5(microtime());// md5 to generate the random string
-
-
$ResultStr = substr($RandomStr,0,5);//trim 5 digit
-
-
$NewImage =imagecreatefromjpeg("img.jpg");//image create by existing image and as back ground
-
-
$LineColor = imagecolorallocate($NewImage,233,239,239);//line color
-
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white
-
-
imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image
-
imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image
-
-
imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);// Draw a random string horizontally
-
-
$_SESSION['key'] = $ResultStr;// carry the data through session
-
-
header("Content-type: image/jpeg");// out out the image
-
-
imagejpeg($NewImage);//Output image to browser
-
-
?>
-
-
2 1623
is php error messaging turned on? do you get any errors?
is GD installed?
Dan
There is no error only captcha image not show on browser
what is gd?
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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.
...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |