473,387 Members | 1,721 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,387 software developers and data experts.

Captcha image Text Size

Hi,

Learning PHP code; playing with various methods of generating captcha
codes:

In the code below, how would I change the size of the text displayed in
the captcha code?
Is it even possible with this method?
TIA,
Twayne

--------------------------
<?php

session_start();

$width = 120;

$height = 40;

$length = 5;

$baseList = '23456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNPQRSTU VWXYZ';

$code = "";

$counter = 0;

$image = @imagecreate($width, $height) or die('Cannot initialize GD!');

for( $i=0; $i<10; $i++ ) {

imageline($image,

mt_rand(0,$width), mt_rand(0,$height),

mt_rand(0,$width), mt_rand(0,$height),

imagecolorallocate($image, mt_rand(150,255),

mt_rand(150,255),

mt_rand(150,255)));

}

for( $i=0, $x=0; $i<$length; $i++ ) {

$actChar = substr($baseList, rand(0, strlen($baseList)-1), 1);

$x += 10 + mt_rand(0,10);

imagechar($image, mt_rand(3,5), $x, mt_rand(5,20), $actChar,

imagecolorallocate($image, mt_rand(0,155), mt_rand(0,155),
mt_rand(0,155)));

$code .= strtolower($actChar);

}
header('Content-Type: image/jpeg');

imagejpeg($image);

imagedestroy($image);

$_SESSION['securityCode'] = $code;

?>

\

---------------------------------


Apr 8 '08 #1
11 2392
..oO(Twayne)
>Learning PHP code; playing with various methods of generating captcha
codes:
You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by bots.
They are definitely _not_ a solution.

Micha
Apr 8 '08 #3
<comp.lang.php>
<Michael Fesser>
<Tue, 08 Apr 2008 23:44:26 +0200>
<ij********************************@4ax.com>
Learning PHP code; playing with various methods of generating captcha
codes:

You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by bots.
They are definitely _not_ a solution.
What do you suggest as a alternative ? .
--
www.krustov.co.uk
Apr 8 '08 #4
this may help you
http://www.php.net/manual/en/functio...char.php#54000
Thanks, I have that manual; it's a great reference and that's one way to
do it, for sure. What I'm really doing is going through a learning
process with PHP and the GD and using captcha for a subject. I have
about three different and excellent methods pulled together and I'm
trying to figure out how to use the best parts of each in one, new
method. Mostly noodling for the education.

Appreciate the comeback!
--
Regards,

Twayne

Open Office isn't just for wimps anymore;
OOo is a GREAT MS Office replacement
www.openoffice.org

Apr 9 '08 #5
rf
"Twayne" <no****@devnull.spamcop.netwrote in news:%IUKj.4310$mL2.220
@trndny03:
>.oO(Twayne)
>>Learning PHP code; playing with various methods of generating captcha
codes:

You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by bots.
They are definitely _not_ a solution.

Micha

1. Who said anything about USING captcha codes on a web site? Only
you, I'm afraid.
Given that the vast majority of questions in this group relate to using
PHP to build web pages I would think the onus is on *you* to mention if
you are doing otherwise.
--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org
Apr 9 '08 #6

"rf" <rf@x.invalidwrote in message
news:82****************@news-server.bigpond.net.au...
"Twayne" <no****@devnull.spamcop.netwrote in
news:%IUKj.4310$mL2.220
@trndny03:
>>.oO(Twayne)

Learning PHP code; playing with various methods of generating
captcha
codes:

You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by
bots.
They are definitely _not_ a solution.

Micha

1. Who said anything about USING captcha codes on a web site?
Only
you, I'm afraid.

Given that the vast majority of questions in this group relate to
using
PHP to build web pages I would think the onus is on *you* to mention
if
you are doing otherwise.
--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org
Ehm.... he DID mention that.
:-P
Richard.
Apr 9 '08 #7
rf
"Richard" <root@localhostwrote in news:47fc2c3d$0$30410$dbd4d001
@news.euronet.nl:
>
"rf" <rf@x.invalidwrote in message
news:82****************@news-server.bigpond.net.au...
>"Twayne" <no****@devnull.spamcop.netwrote in
news:%IUKj.4310$mL2.220
@trndny03:
>>>.oO(Twayne)

Learning PHP code; playing with various methods of generating
captcha
codes:

You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by
bots.
They are definitely _not_ a solution.

Micha

1. Who said anything about USING captcha codes on a web site?
Only
you, I'm afraid.

Given that the vast majority of questions in this group relate to
using
PHP to build web pages I would think the onus is on *you* to mention
if
you are doing otherwise.
--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org

Ehm.... he DID mention that.
:-P
Richard.

Perhaps you could indicate exactly in the above quoted thread where the
OP specifically stated that this was *not* for use in a publicly viewable
web site. In my experience people "learn PHP" by building their first web
page.

--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org
Apr 9 '08 #8
Krustov wrote:
>They are definitely _not_ a solution.

What do you suggest as a alternative ? .
Here are some nice suggestions
http://www.w3.org/TR/turingtest/

best regards
Piotr
Apr 9 '08 #9
"Twayne" <no****@devnull.spamcop.netwrote in news:%IUKj.4310$mL2.220
@trndny03:
>>.oO(Twayne)

Learning PHP code; playing with various methods of generating
captcha codes:

You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by bots.
They are definitely _not_ a solution.

Micha

1. Who said anything about USING captcha codes on a web site? Only
you, I'm afraid.

Given that the vast majority of questions in this group relate to
using PHP to build web pages I would think the onus is on *you* to
mention if you are doing otherwise.

lol, I *said* I was playing with it. Whether i plan to use it or not
has little to do with anything else. Any thinking person answers a
question and THEN if there are some followons, adds them as maybe
caveats or ... .
Answering questions that aren't asked are signs of ego problems at
the other end, IMO. I wrote the post properly for what I wanted to ask
about.

Twayne


Apr 9 '08 #10
"Richard" <root@localhostwrote in news:47fc2c3d$0$30410$dbd4d001
@news.euronet.nl:
>>
"rf" <rf@x.invalidwrote in message
news:82****************@news-server.bigpond.net.au...
>>"Twayne" <no****@devnull.spamcop.netwrote in
news:%IUKj.4310$mL2.220
@trndny03:

.oO(Twayne)
>
>Learning PHP code; playing with various methods of generating
>captcha
>codes:
>
You should forget it. Graphical CAPTCHAs are a huge accessibility
problem and many of them are already broken and can be read by
bots.
They are definitely _not_ a solution.
>
Micha

1. Who said anything about USING captcha codes on a web site?
Only
you, I'm afraid.

Given that the vast majority of questions in this group relate to
using
PHP to build web pages I would think the onus is on *you* to mention
if
you are doing otherwise.
--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org

Ehm.... he DID mention that.
:-P
Richard.


Perhaps you could indicate exactly in the above quoted thread where
the OP specifically stated that this was *not* for use in a publicly
viewable web site. In my experience people "learn PHP" by building
their first web page.

Good grief charley brown; I didn't say it wasn't for use in accessing a
nuclear reactor, nor for protecting anything, nor anything about a web
site, nor ... ... ... ... ... ... .
What you want and what you're going to get from people are two vastly
different things. I don't get why my playing with different methods of
accomplishing the same things captcha code can would piss you off. You
seem to actually be pissed that someone would use captcha code to learns
some things if they weren't going to use it for catpcha code on a web
site. That's interesting, to say the least.
I can just imagine your response if I hadn't mentioned "captcha" and
just said I was fiddling with this code and then showed it! There are
so many variations on how to create captcha code rectangles that it
makes for a great example of different ways todo things. Something I
suspect you are failing to recognize is that studying how others do
things is a great learning tool. I suppose I'm an "oddball" compared to
you since I actually KNOW what code does and if I don't, I try to learn
it and if I can't, I'll ask what appears to be a better authority then
my manuals etc. to figure it out. A forest is made of many trees; in
this case all you see is one forest, I think.

Cheers,

Twayne
Apr 9 '08 #11
Krustov wrote:
>>They are definitely _not_ a solution.

What do you suggest as a alternative ? .

Here are some nice suggestions
http://www.w3.org/TR/turingtest/

best regards
Piotr

Thanks; I had actually found that site already but I appreciate your
effort in posting it; many others will see it too and that's good. Lots
of good reverences there and also at w3c.

--
Regards,

Twayne

Open Office isn't just for wimps anymore;
OOo is a GREAT MS Office replacement
www.openoffice.org
Apr 9 '08 #12

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

Similar topics

4
by: Krishna Kumar | last post by:
Hai all, I am doing a project in .net and in that project I have a problem in capturing text from an image. i.e images like CAPTCHA images . which has inbuilt text with in the image.So,...
0
by: want2learn | last post by:
Hi. I have this CAPTCHA image for .Net in C-Sharp and translate it into VB and as Code_Behind. http://www.mbarrick.com/blog/d6plinks/20061221-01 If i run the site/script i get the site but...
0
by: aaronwmail-usenet | last post by:
Announcing SkimpyGimpy Support for PNG image CAPTCHA generation and PNG canvases. You can now use SkimpyGimpy to generate CAPTCHA text representations as PNG image files in addition to...
7
by: mitchell | last post by:
hi i m using IE 6.0. i want to refresh just the captcha part when the user clicks on an image. i searched for articles on it and got a fairly good understanding of it. but i m still unable to...
4
by: xeiter | last post by:
Hi, I have a captcha script on my website located at /captcha.php. What it does it generates an image with the code, displays the image (gd2) and saves the value of the code in session. How do I...
4
by: mathewgk80 | last post by:
Hi all, I displaed some random numbers in a textbox.. I am having a captcha image and i would like to display that random numbers in captcha image.. The code i used to display the random...
7
by: Joel Fireman | last post by:
I'm looking at the results of searching for "captcha" and "php" - there's a couple hundred of hits that seem to be uniquish... Before I start flogging them, I thought I'd ask the good folks here...
0
by: readnlearn | last post by:
hai, i have written this below code for displaying captcha image whenever i entered incorrect uname,password in login page. for that i disable the controls of captcha like textbox,labels,button and...
10
by: jeddiki | last post by:
Hi, I have a captcha script which should pick up a background image and add some random letters to it and re-display This is the part of the form that the captcha image is part of: <span...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.