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

x
?
Solved

PHP equivalent of ColdFusion <CFABORT>

Posted on 2003-11-10
3
Medium Priority
?
2,178 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
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

618 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