Results 1 to 4 of 4

Thread: Login forms PHP

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Posts
    18

    Login forms PHP

    Hi,

    Just a general question on PHP login forms:

    I have a html login form(Form.html), which then sends the successful user to the next page (loginsuccess.php).

    How can I prevent access to the loginsuccess.php page when typed in the address bar, like so- 'loginsuccess.php'? obviously by doing this its defeating the purposes of a login system.

    Any help would be appreciated.

    Thanks
    Twitter @dancematt

    Programmers unite

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Login forms PHP

    Logic of a login processing page should go something like (pseudo code):
    Code:
    if( login credential [such as a cookie] exists ){
      continue to show page or other logged-in operation
    }else{
      if( form-submitted login values exist ){
        if( login values are correct ){
          give the user a login cookie; continue to show page or other logged-in operation
        }else{
          send the user to the login page (display "wrong username/pass" message)
        }
      }else{
        send the user to the login page
      }
    }

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Posts
    18

    Re: Login forms PHP

    Brilliant, thanks.

    Currently, I am using WAMP server to test my scripts.

    I guess I need an actual web server to use cookies? or is WAMP sufficient?



    Cheers
    Twitter @dancematt

    Programmers unite

  4. #4
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Login forms PHP

    WAMP should be sufficient.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width