My mainpage loads without confirming login...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blackgoat
    New Member
    • Jan 2010
    • 33

    My mainpage loads without confirming login...

    Hi!

    I'm making a website using perl and javascripting. I have a login page and a mainpage that should load when the given login is validated. It works fine if I star with the login page and enter user name and password. But the problem is, that the mainpage loads even by directly typing its address in the address bar. How do I make sure that if this is attempted without loging in first, then the page should not load and redirect to the login page.

    Pls help

    Thanks

    BG
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    set a password in the Apache .htaccess file (if you’re on an Apache server)

    Comment

    • blackgoat
      New Member
      • Jan 2010
      • 33

      #3
      but i'm not using apache.. is there no other way??

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        this you should look up in your server documentation. logging in is best handled on server stage.

        Comment

        • blackgoat
          New Member
          • Jan 2010
          • 33

          #5
          but is dere no way to code it somehow?? u know like if i could add some code to my main page that could check before loading if login has been done or not?? if not, user is redirected to login page...

          Comment

          • GameFreak7744
            New Member
            • Aug 2008
            • 1

            #6
            Check for login cookies at the start of the Perl script, before you output any HTML, if you find them, run them past the database to see if they're valid, and then make the appropriate action from there.
            If the cookies checkout, load the page, if not, send them over to a login page. Simple. =P

            How have you got your login script setup? Because it should be integrated into any pages that are meant to be login only...

            Hell, I normally integrate the login script into -every- page, and display some control panel type links in the page footer if logged in, and a login link if not.

            Comment

            • blackgoat
              New Member
              • Jan 2010
              • 33

              #7
              Thanks !!!!!!!!!!!!!

              Comment

              Working...