|
|
|
5 Steps to Understanding HTML
HTML is a relatively simple language, but that doesn't stop people from having problems with it. Why is that? It's mainly because, while the HTML tags themselves are easy, creating an HTML document that works as intended on a web server requires...
Do search engines like your Web site?
Between 75% and 98.8% of visitors to Web sites come from searches made at search engines. If you're going to get high levels of traffic - and hence the levels of ROI you're looking for - it's very important that the search engines can access all the...
Making Your Website Attractive, Interesting, Engaging and Interactive
In this article you will learn the importance designing your
website around your customers and their needs. A websites form
and content is what will determine if a visitor will stay just a
visitor or turn into your next customer. Today we will...
Search Engine Friendly Web Design Advice
Online marketers understand the importance of getting top search
engine rankings in major search engines. Therefore, they spend
time on search engine optimization (SEO). However, many of them
ignore the fact that web design structure has a role...
What is Web Accelerator?
Web Accelerator is a feature offered on some Dial-Up plans. The
service works by compressing text and images which in turn makes
web pages load faster. An ISP's Web Accelerator feature can
increase a web page's loading speed to five times faster...
|
|
| |
|
|
|
|
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;">
|
|
|
|
|
|