Jump to content

include file displaying


BarrieHie

Recommended Posts

Hello All,

 

Here's the snippet of code and here's what's happening.  Maybe I understand this incorrectly but the

badpass.htm file is displaying under the americaneagleview.htm file.  What I'm trying to do is jump to a file

depending on the password that's entered.    Is there another way to do this???  Is this working correctly by displaying both files???  :-(

 

Barrie

 

 

 

if((($PWadmin == "xxxxx")||($PWadmin == "xxx")||($PWadmin == "xxxxxx")||($PWadmin == "xxxxxx")||($PWadmin == "xxxxxx")||($PWadmin == "xxxxxxx"))) {

    include 'americaneagleview.htm';

    } else {

    include 'badpass.htm';

    }

Link to comment
Share on other sites

you dont need all those brackets. your understanding isnt quite true... if the password you entered is either of those passwords above then it will include the americaneagleview.html file. if its none of those passwords then it will include the badpass.htm file.

Link to comment
Share on other sites

if both files are being displayed then the scrip isnt working

 

 

i dont know about includeing htm files, but try include("file_here"); or require("DITTO");

 

otherwise i dont know whats happening

 

good luck

 

PS  try to have just one valid password, ir would make your if a lot more secure and a lot easier to read

Link to comment
Share on other sites

It is impossible for both of them to be called form that if..else condition.  A condition either evaluates as true or false, not both.  If both files are being included, then either:

 

a) the condition is evaluating true, and somewhere later in your script (not in the else), badpass.htm is being called.

b) the condition is evaluating false, and somewhere before this condition, americaneagleview.htm is being called.

 

in addition to that, if you insist on hardcoding passwords like this, I would suggest this alternative:

$passwords = array("xxxxx","xxx","xxxxxx","xxxxxx","xxxxxx","xxxxxxx");

if(in_array($PWadmin, $passwords)) {
    include 'americaneagleview.htm';
} else {
   include 'badpass.htm';
}

 

though I would recommend against hardcoding passwords like that...

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.