Quantcast
Channel: CodeRewind » PHP & MySQL
Viewing all articles
Browse latest Browse all 10

Creating Protected Pages In PHP

$
0
0
Many times we want to protect a page so that only allowed persons can view it. In PHP we can do this fairly easy by using the SESSIONS. The idea is very simple. The list of allowed members with unique IDs must be stotred somewhere(DB or text files). These users will need to login before entering the protected pages. After successful login the sessions will be registered. On the top of every protected page there will some PHP code. This PHP code will check for the session variables. If some session variables are set for some user say “A”, then that user will be allowed to access only. But if sessions are not set then the PHP code will redirect the page to the login page for authentication. So we need to create login page, protected page, code to create the sessions and code to authenticate the sessions.

Viewing all articles
Browse latest Browse all 10

Trending Articles