?
Solved

PHP equivalent of ColdFusion <CFABORT>

Posted on 2003-11-10
3
Medium Priority
?
2,136 Views
Last Modified: 2013-12-16
I'm rewriting an application to PHP from ColdFusion.

There's a handy ColdFusion tag called <CFABORT>.  It basically stops execution, such as may be appropriate after someone has entered a bad password.  Without this tag, one has to use more if/else logic and it can get tedious.  

For example, with CFABORT, you can code:

<CFIF PasswordStatus IS "Bad">
  BAD PASSWORD! GO AWAY!
  <CFABORT>
</CFIF>
Hi!  
Welcome to our site, authorized user
etc.

Without CFABORT, you'd have to code:

For example, with CFABORT, you can code:

<CFIF PasswordStatus IS "Bad">
  BAD PASSWORD! GO AWAY!
  <CFABORT>
<CFELSE>
  Hi!  
  Welcome to our site, authorized user
  etc.
</CFIF>

Thanks.
0
Comment
Question by:volvopilot
[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
3 Comments
 
LVL 1

Accepted Solution

by:
rstorey2079 earned 500 total points
ID: 9725949
exit();

you can optionally specify an error code as an argument if you wish.

http://us2.php.net/manual/en/function.exit.php

0
 
LVL 7

Assisted Solution

by:minnirok
minnirok earned 500 total points
ID: 9726185
Be careful if you use the exit(); command ( also known as die(); )...   Once the server executes either this function it will stop processing your script.  This will likely cause problems if you're displaying a graphical user interface, since the html tags you'd meant to output after the error occured will not be sent to the client machine.

You should structure your php page with locical IF statements within PHP. So:

<?php
if( $passwordStatus == "Bad" ) {  //return error msg for bad password
   echo "<b>Bad Password! Go Away!</b><br />\n";
} else { // password is good, continue
   echo "Hi!<br />\n" .
           "Welcome to our site, authorized user<br />\n";
} // end if else statement
?>

PHP has built in database connectivity funtions for oracle, mysql, sql server ECT so you'll first need to familiarize yourself with the relevant functions for whatever database you're using.  mySQL is overwhelmingly the most widely used with PHP...  The PHP and Databases forum is better suited for any further elaboration.
0
 

Author Comment

by:volvopilot
ID: 9727003
Thank you, both.

I doubled the points and so I gave you each 125.

Thanks again.
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 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