We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,594 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Help with user authentication...

Hello,

I have a PHP Login Form and it works fine, but users with Fiddler2 (Web Debugging Proxy) have the ability to hide their PHPSESSID Completely. What is a good system that I can use to prevent this, as anonymous users can cause trouble on the website.

3
Contributors
4
Replies
5 Days
Discussion Span
2 Years Ago
Last Updated
5
Views
Chosen13
Light Poster
38 posts since Nov 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0

Most systems I have worked with test for a valid session with every call to a member's only section of a website. This includes RESTful scripts that should only be accessed by logged in users.

If the session doesn't pass your validity test, redirect them to a login page.
Basically, they can hide the session id and in doing so, they are logging themselves out of your system.

For example:

if(!isset($_SESSION['user'])) {
   header('HTTP/1.1 401 Unauthorized');
   header('Location: http://www.mysite.com/login.php');
}

Put a script like the above any place a user can enter your site that requires authorization. This is often a 'front controller' -- a single script that serves up other pages/articles on your site; if not then each script needs to be secured by including this code with a require_once().

madCoder
Junior Poster
165 posts since Feb 2010
Reputation Points: 31
Solved Threads: 45
Skill Endorsements: 0

madCoder is correct, however be careful using require_once or require as if it dies and results in error, the user can then use directory traversal to hack your site.

metalix
Posting Whiz in Training
218 posts since Mar 2010
Reputation Points: 13
Solved Threads: 34
Skill Endorsements: 0

Thank you, but will this still allow offline users to browse pages?

Chosen13
Light Poster
38 posts since Nov 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0

offline browsing is only the user going through their (temp) folder.
So it will always be what they saw last time they were on the site.

metalix
Posting Whiz in Training
218 posts since Mar 2010
Reputation Points: 13
Solved Threads: 34
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0728 seconds using 2.69MB