Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP captcha code

Posted on 2010-08-18
2
Medium Priority
?
268 Views
Last Modified: 2013-12-13
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
0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 total points
ID: 33464197
"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.
0
 
LVL 3

Accepted Solution

by:
grantunwin earned 1000 total points
ID: 33464421
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 */

}              
?>

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question