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
https://forums.phpfreaks.com/topic/36986-include-file-displaying/
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.

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

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.