|
I really need help! Does any one know a code to pass word protect a web page? Like so people have to log in to view it? I saw one JS pass word protect on this site, but the pass word and username can be seen by going to source :S
|
|
|
The methods are code your own or use built in OS or Webserver Software methods.
Web Server Software Methods
On Apache Web servers, there is an .htaccess file that can be configured to protect directories. On Microsoft IIS, it can be integrated with the OS folder security so that only specified Windows users can access the web resource. (But this requires you to setup your users in the Windows Active Directory -- not going to happen unless you control the server.) Are you managing your own webserver or are you hosting with a remote hosting company? What platform? (Most likely either IIS or Apache).
Roll your own
To do real authentication, it must be done server-side (not in client-side javascript). You can have a login system using only client-side javascript, but it will not be secure or reliable. What server-side scripting languages do you have available? If working with IIS, you will have ASP and/or ASP.Net. If Apache, you most likely have PHP, and probably PERL CGI as well.
The #1 downside to most roll your own solutions is that you can only protect scripts -- not every file type. For example, you may have an authentication system built and you include the protection in all your ASP pages, but anybody can still view your proprietary PDF, JPG, and HTML pages. For this reason, you would make all your HTML files ASP pages instead--but your other file types would be protected only by anonyminity. On Windows, I've heard about writing what is called an "ISAPI Filter" to protect files and entire directories, but I don't know anything about it.
I have written both an ASP and a PHP authentication system that I use in my projects. I am willing to share my strategy, but if you are not already an ASP or PHP programmer, it would probably be wasted time. Let us know which Web Server and which language, and we'll try to help from that angle. Also, at that time, let's repost this into the appropriate language forum. (Maybe David will relist it for us--if that's possible without too much hassle.)
|
|
|
|
|
|
|
|
|
|