Mudsaf Posted August 16, 2012 Share Posted August 16, 2012 (edited) Hello again, today im facing this problem. if ($_SESSION['loginattempt'] > 5) { <-- THIS IS [1]//REMOVED CODES HERE if ($rows_check2 == 1) { [2] } else { <-- THIS SHOULD CONTINUE [1], BUT CONTINUES[2] //REMOVED CODES HERE} else { <-- THIS SHOULD CONTINUE [2] //REMOVED CODES HERE} <-- ENDS [2]} <-- ENDS [1] Edited August 16, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
dsonesuk Posted August 16, 2012 Share Posted August 16, 2012 You are producing a condition if[1] -> else[1] -> else[1], you should be producing if[1] -> if[2]-> else[2] -> else[1]. The 'else' that directly following an 'if' IS false alternative of that 'if' condition statement, if the condition is falseif ($_SESSION['loginattempt'] > 5) { <-- THIS IS [1]//REMOVED CODES HERE if ($rows_check2 == 1) { if [2] } END if [2] else { else[2] //REMOVED CODES HERE}<-- ENDS else [2]} <-- ENDS if [1] else { else[1] //REMOVED CODES HERE} <-- ENDS else [1] Link to comment Share on other sites More sharing options...
Mudsaf Posted August 16, 2012 Author Share Posted August 16, 2012 (edited) well how i get this work in this order? any way? if ($_SESSION['loginattempt'] > 5) { [1] IF TRIES > 5 CHECKS SECURITY CODECHECK IF THE ROW2 IS CORRECT ELSE SAYS WRONG CODE if ($rows_check2 == 1) { [2] <-- CHECKS CODE } else { [1] <-- SESSION Loginattempt <= 5 LOGIN SCRIPT HERE --- } [1] <-- CLOSES LOGIN SCRIPT } else { [2] <-- CODE = WRONGecho "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>"; } [2] <-- CLOSES CODE CHECK HAD [1-2] numbers at wrong spot. Need still solution. Edited August 16, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
boen_robot Posted August 16, 2012 Share Posted August 16, 2012 What's wrong with something like if ($_SESSION['loginattempt'] > 5) { //[1] IF TRIES > 5 CHECKS SECURITY CODE//CHECK IF THE ROW2 IS CORRECT ELSE SAYS WRONG CODE if ($rows_check2 != 1) { //[2] <-- CHECKS CODE //[2] <-- CODE = WRONG echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>"; } //[2] <-- CLOSES CODE CHECK} else { //[1] <-- SESSION Loginattempt <= 5 //LOGIN SCRIPT HERE --- } //[1] <-- CLOSES LOGIN SCRIPT Link to comment Share on other sites More sharing options...
Mudsaf Posted August 16, 2012 Author Share Posted August 16, 2012 What's wrong with something likeif ($_SESSION['loginattempt'] > 5) { //[1] IF TRIES > 5 CHECKS SECURITY CODE//CHECK IF THE ROW2 IS CORRECT ELSE SAYS WRONG CODE if ($rows_check2 != 1) { //[2] <-- CHECKS CODE //[2] <-- CODE = WRONG echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>"; } //[2] <-- CLOSES CODE CHECK} else { //[1] <-- SESSION Loginattempt <= 5 //LOGIN SCRIPT HERE --- } //[1] <-- CLOSES LOGIN SCRIPT Well the problem is there at } //[2] <-- CLOSES CODE CHECKsince if u close it completely it doesnt add the login scriptif ($_SESSION['loginattempt'] > 5) { <-- this goes to else --- and if security code == correct it just closes the script before the else. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 16, 2012 Share Posted August 16, 2012 if ($_SESSION['loginattempt'] > 5 && $rows_check2 != 1) { echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>";}else{ //LOGIN SCRIPT HERE} Link to comment Share on other sites More sharing options...
Mudsaf Posted August 16, 2012 Author Share Posted August 16, 2012 if ($_SESSION['loginattempt'] > 5 && $rows_check2 != 1){ echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>";}else{ //LOGIN SCRIPT HERE} Well ur right im kind a idiot, i can do the query if the loginattempt isnt even 5, fixed my problem Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now