• PHP login script help

    Gallard Member

    I’m teaching myself a bit of PHP. I had a login up and running. I was almost ready to crack open a bottle of vin-de-rouge to celebrate as it’s a little milestone for me. However, it appears to have abruptly stopped functioning and I’m yet to determine the cause of this. Could I ask for a script-check over to see if there is anything apparent to whats going on – username and password fields are filled but it submitting the form causes the page to reload. None of the checks are flagged (username/password wrong for instance)

    Thanks

    1. Acess denied, wrong username or password?
    '); 41. } 42. } 43. else 44. { 45. print ('
    Enter something!
    '); 46. } 47. 48.} 49. 50. ?> 51. 52. 53. 54. 55. 56.
    57. Login 58. Please enter your username and password to access the administrator's panel 59. 60. 61. 62.

    Just a thought. Could the issue be due to “LIMIT 1” on the SQL query. Or could my session be messed up somehow?

  • SapnaVishwas Member

    Could it be due to the non space between the class and name fields?

  • Ganesh Member

    Wait. Seems to be something to do with this code I put on the page it redirects to :

    if(!isset($_SESSION["loggedIn"])){ //Kick you back to login if your not logged in
    header("Location: login.php");
    exit;
    }
    

    Any thoughts?

  • SapnaVishwas Member

    How misleading, you never included that code to begin with! Like trying to debug the impossible.

    Anyway, you’re saying if the session key “loggedIn” is not set, that redirect back to the login page. Clearly if this is causing the issue, that session variable isn’t being set.

    In your code you have:

    $_SESSION['loggedin'] = "true";
    

    observe that in the post above me:

    $_SESSION["loggedIn"]
    
  • Viewing 3 reply threads
    • You must be logged in to reply to this topic.
    en_USEnglish