Jump to content

Creating login page

Recommended Posts

You know how you can pwd protect a folder in cpanel, and then when you get linked to a file inside that folder, it asks for a username and password? OK, is it possible to create a login on the page, where users can enter their login data, and it the directs them to the pwd protected page? Also, when they put in a wrong login, that they get a you're not authorized page, without the pop login showing up, allowing for two more tries. Any idea, suggestions? Thanks.

Link to post
Share on other sites

I agree with Bruce - If you don't want to see the popup login box, you'd need to take .htaccess out of the equation. You'd would therefore need a script to handle everything - the login, the display of the 'not authorized' page allowing another login attempt, and the display of the protected page.

Link to post
Share on other sites

Keep in mind that the weakness of using script logins to protect a folder is that it only protects your scripts from being accessed. For example you can use it to stop users from accessing .php pages but I don't believe you can't stop them from accessing resources such as images, simple html or other resources.


If you do stick with HTTP authentication via .htaccess you can still access the username/ password information inside of scripts using variables $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']


If you really don't want to use a popup login box there are techniques you can use to protect non script resources using php scripts. Place the resources in a location outside the public_html area and display them to your users via a php script.

See : http://www.phpdeveloper.org/section/tutorial/52 for an example of this.


hope this helps.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...