slj90 Posted March 1, 2015 Share Posted March 1, 2015 This code checks the users login history and if they have more than 4 failed login attempts in the past 3 minutes it locks their account. However, I'm receiving the error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 36 36: ($diff = strtotime($row['login_time'])-time() $la_sql="SELECT login_username, login_time FROM login_attempts WHERE login_username = '$username'; while($row = mysqli_fetch_array($la_sql)) { $diff = strtotime($row['login_time'])-time(); if ($diff > -300){ $count = $count + 1; } if ($count > 4) { echo "locekd"; } } What's wrong?Thanks, Quote Link to comment Share on other sites More sharing options...
fastsol Posted March 1, 2015 Share Posted March 1, 2015 You're missing a closing " at the end of the first line. SImply viewing the code after you posted it woudl have shwon you that pretty easily 1 Quote Link to comment Share on other sites More sharing options...
slj90 Posted March 1, 2015 Author Share Posted March 1, 2015 You're missing a closing " at the end of the first line. SImply viewing the code after you posted it woudl have shwon you that pretty easily Oh yeah, thanks. I'm now getting this error: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in /home/content/45/10084845/html/your-collection/action/logincheck.php on line 35 correct Quote Link to comment Share on other sites More sharing options...
fastsol Posted March 1, 2015 Share Posted March 1, 2015 If this is all the code for the query, then yo uforgot to actually run the query. You're trying to get the results with the fetch_array but yo unever ran the query beforehand. Also, there is no need for the while() since you are only getting a single row from the db. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.