/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] IF.. ELSEIF.. ELSE.. problem

Parse error: syntax error, unexpected T_ELSEIF in /login-exec.php on line 63

the entire IF.. where it stop’s it.
i can’t seem to find the glitch. but this is my first time dealing with ELSEIF

about this IF .. there are only 3 possible outcomes what this IF has to check. yes, no or blank = “”
for a ban feature

its simple. if STATUS = YES, your banned
if no. your not.
if its empty. go to verify page (basic note, this account has not been verified.. bla bla bla) *hope it helps.
note*
i tryed with 1 =, and 2 ==, same error.
i tried with qouates ” and ‘ no difference

thanks for your help ?

[code=php]
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);

$_SESSION[‘SESS_USERNAME’] = $member[‘Username’];
$_SESSION[‘SESS_PASSWORD’] = $member[‘Password’];
$_SESSION[‘SESS_STATUS’] = $member[‘Status’];

if ($_SESSION[‘SESS_STATUS’] = “no”)
header(“location: member-index.php”);
session_write_close();
exit();
elseif ($_SESSION[‘SESS_STATUS’] = “yes”) // << the error says this ELSEIF
//banned
header(“location: banned.php”);
session_write_close();
exit();
else ($_SESSION[‘SESS_STATUS’] = “”)
//not authorised
header(“location: verified.php”);
session_write_close();
exit();
}
}
?>
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 14.2011 — You forgot the curly braces for each of those internal if/elseif/else blocks.
Copy linkTweet thisAlerts:
@Sn00pYauthorNov 14.2011 — fixed it, b4 i read. the below was my solution..

*probly as NogDog suggested, he is a great help allways

[code=php]
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);

$_SESSION['SESS_USERNAME'] = $member['Username'];
$_SESSION['SESS_PASSWORD'] = $member['Password'];
$_SESSION['SESS_STATUS'] = $member['Status'];

if ($_SESSION['SESS_STATUS'] == "no"){
header("location: member-index.php");
session_write_close();
exit();
}
else if ($_SESSION['SESS_STATUS'] == "yes"){
//banned -line 65
header("location: banned.php");
session_write_close();
exit();
}
else if ($_SESSION['SESS_STATUS'] == ""){
//not authorised
header("location: verified.php");
session_write_close();
exit();
}
else{

}
}
//login fail
header("location: login-fail.php");
session_write_close();
exit();
}
?>
[/code]


*editors note ; the code above works. tried n tested all state's myself.
×

Success!

Help @Sn00pY 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,
)...