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

comapring two variables of strings

hi,

i am building a small mail form system that i want to make it safe as
much as i can, so i added a ramdomly generated 4 characters that my
user have to enter in the corresponding text box so that if he entered
these characters correct the mail is sent if not the error message
appear.

what i have:
1- i used a randomly generated 4 characters
2- text bex for the user to enter the randomly generated variables
3- if else statement:

my if...else code

if ($UserEnteredText == $RandomText){
echo "correct";
}
else{
echo "wrong";
}
my problem:
always the code echos wrong message, which means that i have a problem
that i dont know what is it.

so please help me
I really need your help ASAP

Thanks in advance

shror
www.s7els7.com

Mar 6 '07 #1
8 1206
shror wrote:
hi,

i am building a small mail form system that i want to make it safe as
much as i can, so i added a ramdomly generated 4 characters that my
user have to enter in the corresponding text box so that if he entered
these characters correct the mail is sent if not the error message
appear.

what i have:
1- i used a randomly generated 4 characters
2- text bex for the user to enter the randomly generated variables
3- if else statement:

my if...else code

if ($UserEnteredText == $RandomText){
echo "correct";
}
else{
echo "wrong";
}
my problem:
always the code echos wrong message, which means that i have a problem
that i dont know what is it.

so please help me
I really need your help ASAP

Thanks in advance

shror
www.s7els7.com
What's in $UserEnteredText and $RandomText when you make the test? Echo
them to the window to find out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 6 '07 #2
shror wrote:
if ($UserEnteredText == $RandomText)
At a guess, the receiving script regenerates a new value for $RandomText,
rendering the text that the user entered, based on the previous random
text, incorrect.

If you feel you really *must* do this, then take a look at the
Text_CAPTCHA module in PEAR instead of re-inventing the wheel.

But be aware that CAPTCHA techniques are usually inaccessible to at least
one portion of society, often blind people. This can make their use in
some countries illegal under disability discrimination legislation.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 7 '07 #3
On Mar 7, 8:58 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
shror wrote:
if ($UserEnteredText == $RandomText)

At a guess, the receiving script regenerates a new value for $RandomText,
rendering the text that the user entered, based on the previous random
text, incorrect.

If you feel you really *must* do this, then take a look at the
Text_CAPTCHA module in PEAR instead of re-inventing the wheel.

But be aware that CAPTCHA techniques are usually inaccessible to at least
one portion of society, often blind people. This can make their use in
some countries illegal under disability discrimination legislation.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
my idea is that when the mail form is loaded the randomly generated
characters are also loaded and echoed and the user will only have to
enter the echoed characters so that my system knows if its a human or
not who is using the form

someting for spam protection of my self and my users

Thanks
shror
www.s7els7.com

Mar 7 '07 #4
shror wrote:
my idea is that when the mail form is loaded the randomly generated
characters are also loaded and echoed and the user will only have to
enter the echoed characters so that my system knows if its a human or
not who is using the form
It would take maybe 10 minutes to write a robot that could defeat that.
Use Text_CAPTCHA.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 8 '07 #5
On Mar 8, 2:45 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
shror wrote:
my idea is that when the mail form is loaded the randomly generated
characters are also loaded and echoed and the user will only have to
enter the echoed characters so that my system knows if its a human or
not who is using the form

It would take maybe 10 minutes to write a robot that could defeat that.
Use Text_CAPTCHA.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
my problem is that i dont know how to write robot and i dont know how
robot works to write it, so i decided to do something like what yahoo,
google, hotmail and all website do now which is telling you to enter
the characters in the image correctly, i think that this is some sort
of security, isn't it

so all what i want to do is check two variables carrying string of
characters if they are identical or not and i dont know how to check
them, i tried but i got wrong outputs, so i need your help please.

Thanks
shror
www.s7els7.com

Mar 8 '07 #6
shror wrote:
On Mar 8, 2:45 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
>shror wrote:
>>my idea is that when the mail form is loaded the randomly generated
characters are also loaded and echoed and the user will only have to
enter the echoed characters so that my system knows if its a human or
not who is using the form
It would take maybe 10 minutes to write a robot that could defeat that.
Use Text_CAPTCHA.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

my problem is that i dont know how to write robot and i dont know how
robot works to write it, so i decided to do something like what yahoo,
google, hotmail and all website do now which is telling you to enter
the characters in the image correctly, i think that this is some sort
of security, isn't it

so all what i want to do is check two variables carrying string of
characters if they are identical or not and i dont know how to check
them, i tried but i got wrong outputs, so i need your help please.

Thanks
shror
www.s7els7.com
Shror,

You don't need to know how to write a robot - the key here is SOMEONE
ELSE does. And it can be done very quickly, as Toby pointed out.

Did you try my suggestion of echoing both values to the screen instead
of doing a compare? See what they say?

Also - do you have all errors enabled?

Did you follow Toby's suggestion to search on CAPTCHA? There are a lot
of ready-made packages out there.

Instead of arguing with everyone, why not try some of the suggestions?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 8 '07 #7
Message-ID: <tM******************************@comcast.comfro m Jerry
Stuckle contained the following:
>Did you follow Toby's suggestion to search on CAPTCHA? There are a lot
of ready-made packages out there.

I've just used this one
http://captcha.ru/en/kcaptcha/
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Mar 8 '07 #8
On Mar 8, 8:20 pm, Geoff Berrow <blthe...@ckdog.co.ukwrote:
Message-ID: <tM******************************@comcast.comfro m Jerry
Stuckle contained the following:
Did you follow Toby's suggestion to search on CAPTCHA? There are a lot
of ready-made packages out there.

I've just used this onehttp://captcha.ru/en/kcaptcha/
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDshttp://www.ckdog.co.uk/rfdmaker/
am sorry but at first i didnt recognize whats the CAPTCHA is
but i have just downloaded the one Geoff Berrow mentioned, and am
working on understanding how to save its files on my host space.

Thanks for all your help and sorry once more but i feel ashamed

shror
www.s7els7.com

Mar 9 '07 #9

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

Similar topics

1
by: Rolf Kemper | last post by:
Dear All, does have anybody have an idea how to add to number strings in xslt ? My strings are in variables eg. '1A2' , '00F' which should sum up to '1B1'. I may prefix the variables with...
3
by: Anthony Robinson | last post by:
We're encountering an issue with working with CLOB's. We're doing a basic insert into a table that has a CLOB column. Sometimes the CLOB is fairly tame in size (10k-15k), and once in a while...
6
by: RFS666 | last post by:
Hello, After I posted yesterday "using C# class in jscript", I have a new problem: I have a C# class - DBResult - that contains (and other variables) a string array (and other variables), that...
5
by: Just Me | last post by:
Using streams how do I write and then read a set of variables? For example, suppose I want to write into a text file: string1,string2,string3 Then read them later. Suppose I want to write...
6
by: calcop | last post by:
Hello everyone, I hope I can write this question clearly. Anyway, it is about global variables. I have several files in my C++ project. One of which is main.cpp. This file comtains my main()...
14
by: manstey | last post by:
Hi, Is there a clever way to see if two strings of the same length vary by only one character, and what the character is in both strings. E.g. str1=yaqtil str2=yaqtel they differ at str1...
3
by: Gal Diskin | last post by:
Following a discussion with an associate at work about various ways to build strings from variables in python, I'd like to hear your opinions and preferred methods. The methods we discussed are:...
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.