Jump to content

PHP DIE Function


chris_davidsonuk

Recommended Posts

I am using login script I found at http://www.free2code.net/plugins/articles/read.php?id=99. It uses 'DIE' to stop the script when a username or password is incorrect.

The problem I am having is that I have my menu at the bottom of the page which I include into the page. But if the user dosn't enter the correct username and password the script is terminated so the menu doesn't show.

[code]
if(!$_POST['uname'] | !$_POST['passwd']) {

die('You did not fill in a required field.<br>');

}
[/code]

Is there anyway to include my footer file (footer.php) even if the script has 'DIED' ?
Link to comment
Share on other sites

Hi,

The easy solution to your problem is to use this:
[code]
<?php
if(!$_POST['uname'] | !$_POST['passwd']) {
echo 'You did not fill in a required field.<br>';
}
?>
[/code]

This won't stop the script, but it will tell you when the condition has failed.
Hope it works!
Iceman
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.