PHP captcha code

0
August 16, 2011

Dear Experts,

          <?php if (isset($_GET["hdwmsg"]) && $_GET["hdwmsg"] == "invalid") echo chr(60)."font color=red".chr(62)."Please

, enter the correct security code.".chr(60)."/font".chr

(62);

              ?>

I want to end it if the security code is not ok.

What should I do?

I'm submiting the form on the same page..

I insert the data to my database and send an email after this code,

if I write security code wrong I receive this error message but it "Please, enter the correct security code." But it doesn't stop there.. it goes below and insert the data and sends email..

thank you

2

answers

Comments See all(0)

Add comment
0
August 16, 2011

add an 'elseif' to your 'if' statement like this:

<?php 
if (isset($_GET["hdwmsg"]) && $_GET["hdwmsg"] == "invalid") {
     echo chr(60)."font color=red".chr(62)."Please, enter the correct security code.".chr(60)."/font".chr(62);
} elseif (isset($_GET["hdwmsg"]){

/* add the code here that inserts the data and sends the email. This will not be executed if the first if statement is satisfied. Solving your problem */

}              
?>
0
August 16, 2011

"it goes below and insert the data and sends email.."

Obviously you have an error in your logic!

You can use the php function die() to stop the script from executing any more instructions.

Related Questions

How can I add my captcha code to this php page?

Hi there, I have a php page and I would like to add a standard captcha code in it. The captcha code is here: &lt;td colspan=&quot;8&quot;&gt;&lt;img alt=&quot;CAPTCHA Image&quot; src=&quot;/securimage Read More

Views

31

Votes

0

Answers

11

August 15, 2011

Session variable empty in PHP on IIS7

Good Day I have a bit of a problem as to where my sessions variable is empty. If you have a look at the code below and when it is executed the captcha returns the image, so I know the php is working. Read More

Views

29

Votes

0

Answers

5

August 16, 2011

Editing a Php contact form template

Script I am editing is listed below.... &#160;the problem is found &#160; &#160; $embody = &#39;$name[2], $embody[2], $email[2], $number, $located, $subject, $why, $otherparty&#39;; &lt;?php session_s Read More

Views

177

Votes

0

Answers

4

August 16, 2011

online form not working

We are using http://www.tectite.com/ for an online form on the below website: http://myrascakes.com/orde r.html We keep getting an error and don&#39;t know how to fix it. &#160;There is a r Read More

Views

946

Votes

0

Answers

15

August 15, 2011

How do I include a php script in my perl program?

I have found an attractive Captcha program that I&#39;d like to use on a Web site. &#160;It&#39;s very customizable, and can be made as simple (and as easy to read) as I like. &#160;However, I&#39;m c Read More

Views

17

Votes

0

Answers

5

August 16, 2011

Change text color when invalid CAPTCHA

Hello guys, I have just implemented a CAPTCHA routine (with help from the experts here) and want to manage the invalid CAPTCH by changing the text color of the following: &quot;Please enter the code a Read More

Views

104

Votes

0

Answers

16

August 15, 2011

Formatting Web Form output email in HTML

I am trying to format the email output of a web form. &#160;I would like to be able to format the email that is sent using HTML. &#160;So, I could make a table with all of the fields and values in it Read More

Views

38

Votes

0

Answers

8

August 15, 2011

JS alert box on top of existing window, generated from PHP script

I am working on some form validation tests. &#160;A simple validation example below checks if an input is blank. When the test if false, I would like to popup a alert box with the error message and an Read More

Views

25

Votes

0

Answers

6

August 16, 2011

Refresh Captcha

I am using code given in this link to create captcha images. http://www.dreamincode.net /forums/sh owtopic542 75.htm The code is working fine, but I have a hyperlink o Read More

Views

3

Votes

0

Answers

4

August 16, 2011

PHP MySQL Record will not Update

Hello Experts, I have a PHP SCript that worked before but suddenly quits. &#160;It returns a Blank age and takes forever to process, It says it is waiting on the local host. &#160;Can someone tell me Read More

Views

48

Votes

0

Answers

4

August 15, 2011

Problem with PHP Script Inserting Image name into database

Hi Experts, I have &#160;form that is mostly working. You can see it in action here: http://www.enviromedia.com /careers/x m-recruiti ng/ If I complete the form but DO Read More

Views

106

Votes

0

Answers

17

August 16, 2011

PHP and mySQL forms maker?

Hello, I have to make 10 small web sites over the next 30 days and was looking for a tool that would help me make forms to be entered in EACH web sites mySQL database? &#160;I have seen form makers bu Read More

Views

34

Votes

0

Answers

1

August 16, 2011

post message back to form once form submitted

Hi I have a php script running as the action of my website forms.. with some hidden fields in it that refer to array in script. I would like to display a thankyou message to submitter in the bottom of Read More

Views

58

Votes

0

Answers

11

August 16, 2011

Php session variables

I am trying to install &#160;a contact.php form with captcha. I bought the script from a website and software developer. The working version of his form is at http://www.easyflv.com/con tac Read More

Views

45

Votes

0

Answers

14

August 15, 2011

Best Practice for Inserting from PHP Form into Database

I need to know the best practices for writing a form processing script. I really want to code this myself &#39;caus there is so much extra stuff in Dreamweaver (Granted I use it to do my html) but whe Read More

Views

17

Votes

0

Answers

13

August 15, 2011

Help with php form processor

I have the code below as my form processor, My webform is basic, and contains: Name, email address, subject, colony, comment and a captcha along with the send button. I have the form working but I dec Read More

Views

28

Votes

0

Answers

6

August 16, 2011

Stopping direct access to php files

Hi all, I have my own php site with a messageboard, but I&#39;m having a spam problem lately. I have a captcha which does string verification, but it seems that they are circumventing it by calling th Read More

Views

22

Votes

0

Answers

16

August 16, 2011

How can I add a script into a html page using FCKeditor

Hi, I am trying to add a CAPTCHA code to a form on a website. The form was created in a CMS system. &#160;When I try to add a script to the html source code, it strips the code away. Joomla does the s Read More

Views

29

Votes

0

Answers

9

August 16, 2011

PHP database and time diffrence question

Dear Experts, $query = &quot;SELECT Email,Date FROM Mytable where Email=&#39;$visitormail&#39;&quot;; $sql=mysql_query($query); $result = mysql_fetch_array($sql); $date_comingfrom_database = $result[& Read More

Views

43

Votes

0

Answers

6

August 16, 2011

How to create the image seen in the url..? (A secutiry code image)

http://www.blog.fr/captcha .php?id=29 How to create the effect seen in the animated gif with php..? Read More

Views

32

Votes

0

Answers

2

August 16, 2011