D.Y.
PATIL TECHNICAL CAMPUS, TALSANDE
FACULTY OF ENGINEERING & FACULTY OF
MANAGEMENT
(Polytechnic)
A Micro project Report On
“Captcha Generator using PHP”
Submitted By
Enrollment No. Name
2112200051 Kulkarni Sanskar Mandar
Guided By
Miss. Desai M. U.
D.Y. PATIL TECHNICAL CAMPUS, TALSANDE FACULTY OF
ENGINEERING & FACULTY OF MANAGEMENT
(Polytechnic)
DEPARTMENT OF COMPUTER ENGINEERING
SEMESTER VI
CERTIFICATE
This is Certify that student of Computer Engineering has
successfully completed the project term work “Captcha Generator using
PHP” in partial fulfilment of the Diploma of Engineering in Computer as laid
down during academic year 2023-24.
Roll No. Name of Student Exam Seat No.
3216 Kulkarni Sanskar mandar
Miss. Desai M. U. Mr. Kumbhar R. S.
Project Guide HoD
Dr. S.R. Pawaskar
Principal
Date – / /2024
Place – Talsande
INDEX
Sr No. Title Page no.
1 Introduction 1
2 Source Code 2
3 Outputs 3
4 Conclusion 4
5 References 5
Captcha Generator using PHP
Introduction:
CAPTCHA stands for the Completely Automated Public Turing test to tell Computers and
Humans Apart. CAPTCHAs are tools you can use to differentiate between real users and
automated users, such as bots. CAPTCHAs provide challenges that are difficult for computers
to perform but relatively easy for humans. For example, identifying stretched letters or
numbers, or clicking in a specific area.
CAPTCHAs work by providing information to a user for interpretation. Traditional captchas
provided distorted or overlapping letters and numbers that a user then has to submit via a form
field. The distortion of the letters made it difficult for bots to interpret the text and
prevented access until the characters were verified.
This captcha type relies on a human’s ability to generalize and recognize novel patterns based
on variable past experience. In contrast, bots can often only follow set patterns or input
randomized characters. This limitation makes it unlikely that bots will correctly guess the right
combination. Since captcha was introduced, bots that use machine learning have been
developed.
These bots are better able to identify traditional captchas with algorithms trained in pattern
recognition. Due to this development, newer captcha methods are based on more complex tests.
For example, reCAPTCHA requires clicking in a specific area and waiting until a timer runs
out.
D.Y. Patil Technical Campus, Talsande
Faculty of Engineering and Faculty of Management 1 |5
Captcha Generator using PHP
Source Code:
<?php
session_start();
$msg = '';
// If user has given a captcha!
if (isset($_POST['input']) && sizeof($_POST['input']) > 0)
// If the captcha is valid
if ($_POST['input'] == $_SESSION['captcha'])
$msg = '<span style="color:green">SUCCESSFUL!!!</span>';
else
$msg = '<span style="color:red">CAPTCHA FAILED!!!</span>';
?>
<style>
body{
display:flex;
flex-direction:column;
align-items: center;
justify-content: center;
}
</style>
<body>
<h2>PROVE THAT YOU ARE NOT A ROBOT!!</h2>
<strong>
Type the text in the image to prove
you are not a robot
</strong>
<div style='margin:15px'>
<img src="captcha.php">
</div>
<form >
<input type="text" name="input"/>
<input type="hidden" name="flag" value="1"/>
<input type="submit" value="Submit" name="submit"/>
</form>
<div style='margin-bottom:5px'>
<?php echo $msg; ?>
</div>
<div>
Can't read the image? Click
<a href=''">
here
</a>
to refresh!
</div>
</body>
D.Y. Patil Technical Campus, Talsande
Faculty of Engineering and Faculty of Management 2 |5
Captcha Generator using PHP
Output:
D.Y. Patil Technical Campus, Talsande
Faculty of Engineering and Faculty of Management 3 |5
Captcha Generator using PHP
Conclusion:
We have seen that by distinguishing between humans and computers, CAPTCHAs offer
protection against automated attacks on systems and applications. The criterion for success of
a text-based CAPTCHA are its robustness and usability. We have outlined techniques in the
Obfuscator module to generate the challenge that render CAPTCHA robust as it is resistant to
Bot attacks that employ OCR technology.
CAPTCHA is highly usable as it is easy for humans to successfully provide the response. Since
we are using words from books and newspapers or an assortment of characters that are non -
words, it is not difficult for humans to visually perceive these characters despite the distortions
and noise due to their superior visual capabilities and cognitive abilities to make connections
with words that they have encountered in some context. Distorted images containing random
strings are still easy for humans to read while computers spend endless time processing
information. The implementation of CAPTCHA and the participation in OCR testing efforts
related to Indian language scripts is to be taken up as future research work. Handwriting
recognition and testing for Devanagari script is another future research activity.
D.Y. Patil Technical Campus, Talsande
Faculty of Engineering and Faculty of Management 4 |5
Captcha Generator using PHP
Reference:
• https://airccse.org/journal/IJAIT/papers/0811ijait04.pdf
• https://chat.openai.com/
• https://phppot.com/php/php-captcha/
• https://www.geeksforgeeks.org/how-to-generate-captcha-image-in-php/
• https://www.w3schools.in/php/examples/captcha
D.Y. Patil Technical Campus, Talsande
Faculty of Engineering and Faculty of Management 5 |5