473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to verify the code?

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 strtoupper(substr(md5(uniqid(rand())),rand(0,32-$i),
$i));
}
echo Pass(4)."<br>";
echo;
?>

======

But I don't know how to generate an text area for my visitors to input
the code, and verify the value with the combination.

Can anyone help me to finish the rest of the verification process?
Thanks thanks thanks thanks a million.

Sep 16 '07 #1
5 2014
But I don't know how to generate an text area for my visitors to input
the code, and verify the value with the combination.

Can anyone help me to finish the rest of the verification process?
Thanks thanks thanks thanks a million.
You need an image to generate the Captcha random letters, store that
generated string in the $_SESSION super globals ($_SESSION['Captcha']
or something like this) and then, check the input from the form
against the $_SESSION.

The image with the random captcha text can be created with php built-
in function to manip images. Then on your form, you just need to add
the captcha image something like: <img src="captcha.php" /and that
captcha.php file should generate the image and set the text in the
session.

At least, thats my way...

Sep 16 '07 #2
On 9 16 , 9 31 , ptd...@gmail.com wrote:
But I don't know how to generate an text area for my visitors to input
the code, and verify the value with the combination.
Can anyone help me to finish the rest of the verification process?
Thanks thanks thanks thanks a million.

You need an image to generate the Captcha random letters, store that
generated string in the $_SESSION super globals ($_SESSION['Captcha']
or something like this) and then, check the input from the form
against the $_SESSION.

The image with the random captcha text can be created with php built-
in function to manip images. Then on your form, you just need to add
the captcha image something like: <img src="captcha.php" /and that
captcha.php file should generate the image and set the text in the
session.

At least, thats my way...
thanks for replying.

well......I really don't need to go that far. I think for now a random
text is enough.

Now I can make my webpage generates a random combination. All I need
next is to creat a text area to compare with the randon code
generated, as what I said in my first article.

Can anybody help me with the rest part of the verifying process?
thanks.
Sep 16 '07 #3
Now I can make my webpage generates a random combination. All I need
next is to creat a text area to compare with the randon code
generated, as what I said in my first article.
something like this:

<!-- create the form -->

<form method="POST">
Please, write down the following code: <?php
$code = Pass(4);
$_SESSION['Captcha'] = $code;
echo $code; ?>
<input type="text" name="code" />
<input type="submit" />
</form>

<!-- check the code -->
<?php

$valid = 0;
if (isset($_POST['code'])) {
if (isset($_SESSION['code'])) {
$valid = $_POST['code'] == $_SESSION['code'];
}
}
echo 'The code is ', ($valid ? 'valid' : 'invalid');
?>

Sep 16 '07 #4
Sorry, not:
$_SESSION['Captcha'] = $code;

But:
$_SESSION['code'] = $code;
Sep 16 '07 #5
On 9 16 , 10 32 , ptd...@gmail.com wrote:
Sorry, not:
$_SESSION['Captcha'] = $code;

But:
$_SESSION['code'] = $code;- -

- -
Hi

I just want to say "thank you".

with your help, I made a little adustment myself. I've got it all
figured out.

Thanks again. :)

Sep 16 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Wayne Wengert | last post by:
I want to write a Windows application to go through all the email addresses in an SQL Server table and to report which ones are invalid. From Googling and perusing NGs it is my understanding that...
0
by: jpr | last post by:
Hello, I need some help. I have a form named MASTER based on a table also called MASTER. A control of my form in names SSN which stores the client SSN. On the same form I have placed a subform...
5
by: Nomen Nescio | last post by:
I'm running gpg in python to verify a signature. I can see that it is working, because gpg is displaying the results. But I need a way to let the python script know this. According to the gpg...
3
by: Steve Brecher | last post by:
I have some code comprising the onsubmit attrribute of a form. The code is executing, but apparently a function called as the last statement is not executed. The form content is submitted to the...
0
by: CHC | last post by:
Hi, I would like to verify the authenticity of a X509 digital certificate. I'm using Crypt::X509 to create a certificate object and can extract the data fields. But, I can't find a way to verify...
43
by: Xancatal | last post by:
Hey everybody. I need help on this one. I need to verify that a number entered by a user is not either a negative number (-100.00), or an alphabet (a, b, c, X, Y) as well as other number other than...
3
by: Grey | last post by:
I have to write a program to verify email address availability. i have to verify thousand of email address. is there any way to verify the email in ..net instead. the requirement is to verify which...
1
by: netrudra2 | last post by:
The following code is not working.it gives the same error messege as it gives when program specified for win95/98 is run. #include <stdio.h> #include <conio.h> #include <windows.h> #include...
1
by: wootmaster | last post by:
I'm writing a script that will run a few tests on a given mail server, it's meant to test to see if VRFY and EXPN is enabled or not. However, when I use "verify" to test to see if VRFY is enabled on...
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...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.