Search
Recommended Sites
Related Links






   

Informative Articles

Affiliate Alternative; Google Adsense
The Rise and Fall of Affiliate Programs Affiliate programs were once a great source of online revenue, a savvy webmaster with an eye for marketing could easily parley a site into a money making machine with a little luck and effort. However,...

Awards Programs: Judging Sites
Okay, so you've taken the plunge and created your awards program. Your criteria are defined and well written, your purpose is understood and you've promoted the heck out of your program. Now you've started getting applications - and the real work...

Can I Optimize A Site Designed With Frames?
Can you optimize a site designed in frames? Of course you can! The question should be, "how effectively can I optimize a web sire designed in frames?" Framed sites – in my opinion – have little use in today's web design....

Digital Point's Coop Ad Network
Digital Point's Coop Advertising network is really nothing more than a large automated link exchange. Originally it was supposed to be an automated link exchange for webmaster forums running vBulletin software. How it works is you load code on...

What Is Waiting for Us? :: Tomorrow's SEO Industry
Today, SEO is swiftly approaching saturation point. More and more webmasters realise the necessity of learning SEO basics, and as they do so, SEO professionals are facing difficulties finding new clients. With all the niche sites optimised, it...

 
Javascript Password Protection


The protection of web pages using a password comes up earlier or later while developing your site. The most secure way is to implement PHP, ASP or other advanced web programming languages. In this tutorial you will find out how to protect pages using Javascript, because you may need to have a very simple protection, or your current hosting may not support PHP.

The first example we are going to discuss is the prompt() function. The function calls a small box to appear, and unless you enter correct password, you will not be able to view the page. The advantage is that you can't view the source code to find out the password without turning Javascript off. The code is as follows:









Now let's look at the code. When you enter the correct password, a box appears saying that Access is Granted, and the rest of the page is loaded. If the password is incorrect, you are redirected to denied.php. I used a little trick with the password here that can stop some unexperienced hackers ;)) the FAKEPASS is not the actual password, even though you can make it look like it. This is just a variable that is described in an external file - "prompt.gif". This is another trick - the external Javascript file has an extension .gif , which is used for images. The file however contains text, and the server will correctly treat it like a text file, not an image. So the content of prompt.gif is:



var FAKEPASS = "the_real_password";



As you see, here our variable is substituted with the word "the_real_password", which is the actual password.


The second option in protecting a page with Javascript is much prettier, and it actually allows you to have several login and password accounts. The code is:



Login



style="position:absolute;top:100;left:300;visibility:hidden;">


Entrance  

 Login:  

 Password:


 



Sign up for PayPal and start accepting credit card payments instantly.