dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Local Sessions

  1. #1
    Join Date
    Jul 2009
    Posts
    48

    Question Local Sessions

    Hello all,

    I have made a login screen (it's local) so people need a username and password to use it. it is all working but except for the fact that people can just open a new tab, i would like it so when they try and browse without a username and password it asks them to login before continuing.

    Any help Appreciated.

  2. #2
    Join Date
    Jan 2010
    Location
    Cambridge, UK
    Posts
    42
    In which language is it? If it's in PHP, for example, you need to create a session using session_start(). When the user has logged in, you add a session variable with their username or a logged_in flag or something and then check that at the start of each page. If it exists, they're logged in and all is well, otherwise redirect them to the login page.

  3. #3
    Join Date
    Jul 2009
    Posts
    48
    well from experience i know php does not work when it is a local file and my main language is javascript and it stops them from accessing a different website unless they have logged in, like an internet proxy

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You may use javascript cookies:
    http://www.quirksmode.org/js/cookies.html

  5. #5
    Join Date
    Jul 2009
    Posts
    48
    on the website you gave me, i did not see anything to stop people from accesing the internet without loging in through the local file, i have thought about cookies for telling the user they are logged in when they press home though.

  6. #6
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Use cookies to store some data when people do login (so that to verify later if they are logged). Check within each of your documents if that cookie exists. If not, redirect them to the login page.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles