Monthly Archives: February 2010

JavaScript Confirm Box

Many times, in life, one needs to confirm things. For example, you might be writing a UI for a nuclear submarine and you need to add a confirm box whether the link should be followed (which might as a result launch a nuke or delete a record) or not. You can do it the hard way by writing PHP/ASP code but I like to do it the easy way, by using JavaScript.

A really simple approach is:

Delete

When the user clicks on it, this will produce the a pop up box, displaying that message and two buttons. If the user click yes, the link is followed otherwise nothing happens, and we live again ;)

Block access to .htaccess

Before I answer the ‘how’, let me answer the ‘why’.

.htaccess, now a days, plays a major role. It lets you re-write URLs, redirect traffic, and if you are really good with it, point people to different scripts on your website. It is also an excellent way to cloak your web space structure.

The problem occurs if someone is able to have a look at your .htaccess file and see how things are processed at the ‘back stage’. Or the reason could be that you have written a state-of-an-art .htaccess file and want those 16 year olds to stay away from it.

Just place this at the top of your .htaccess file and you can sleep peacefully, once again ;)


order allow,deny
deny from all