/    Sign up×
Community /Pin to ProfileBookmark

My Login script with rank groups only shows 2 rank consoles

i have a login script that has rank groups and there is 1 thats just a normal member and the other is officer/warrant officer and the other is generals and then last but not least commanders

when i login in as a test account called fred it only shows members and the officers and warrant officers console option his rank value is 26 why is this?

This is my ranks part of the script

[code=php]
if($data[‘rank’]<=26 && $data[‘rank’]>=11)
{
include(“includes/officers.inc.php”);
}
else if($data[‘rank’]<=26 && $data[‘rank’]>=22)
{
include(“includes/generals.inc.php”);
}
else if($data[‘rank’]<=26 && $data[‘rank’]>=26)
{
include(“includes/commanders.inc.php”);
}
[/code]

How can i fix this?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@shane_carrSep 01.2006 — when i login in as a test account called fred it only shows members and the officers and warrant officers [B]console option his rank value is 26[/B] why is this?[/quote]
I don't understand that part of your question, could you be more clear?

Looking at your script, the problem may be here:
[code=php]else if($data['rank']<=26 && $data['rank']>=26)[/code]
that line is pointless as for any rank that passes true there would also have passed as true in the past two checks. And also, if that is what you meant, you could have said [code=php]else if($data['rank']==26){[/code] because "<=26 && >=26" is equal to "==26". And, there is no place in the script where someone who's rank is over 26 to appear.
Copy linkTweet thisAlerts:
@shane_carrSep 01.2006 — another tip, you should sort officers from whatever from greatest to least. Perhaps this code wuold be of help:

[code=php]$r = $data['rank'];

if($r>26){

include "includes/commanders.inc.php";

}else if($r>=22){

include "includes/generals.inc.php";

}else if($r>=11){

include "includes/officers.inc.php";

}else{

echo "You do not rank high enough to be shown information. You must gain at least 11 points to access this page.";

}[/code]
Copy linkTweet thisAlerts:
@william232authorSep 01.2006 — i only see the officers/warrant officers console if i did it the other way how can i fix that?
Copy linkTweet thisAlerts:
@shane_carrSep 04.2006 — Can you please explain in more depth? What console? Where is the ranking drawn from and what is it? If you're an officer can you see the warrant officer's page?
Copy linkTweet thisAlerts:
@The_Little_GuySep 04.2006 — what if you made it [B]$data['rank'] < 26[/B]?
Copy linkTweet thisAlerts:
@shane_carrSep 09.2006 — Okay:

[code=php]if($data['rank']<=26 && $data['rank']>=11)
//this wil execute as true if the number is between 11 and 26
{
include("includes/officers.inc.php");
}
else if($data['rank']<=26 && $data['rank']>=22)
//this will execute as true if the number is between 22 and 26
//any number that is between 22 and 26 is also between 11 and
//26, so that number will never reach this if statement. Perhaps
//your problem will be solved if you take out the "else"?
{
include("includes/generals.inc.php");
}
else if($data['rank']<=26 && $data['rank']>=26)
//same problem with this one
{
include("includes/commanders.inc.php");
} [/code]
×

Success!

Help @william232 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...