How do I block direct access to critical files using .htaccess?

Critical files, Let say configuration.php file for Joomla
1. Make a backup copy of your .htaccess file. Use your backup file to recover if the following fails. Be sure to delete the backup file once you are finished.
2. Add the following to your .htaccess file. This example will protect the configurtation.php file.

<filesMatch "configuration.php">
Order allow,deny
Deny from all

Magic Trick: Allow/Prevent Directory Browsing

Most servers are configured so that directory browsing is not allowed, that is if people enter the URL to a directory that does not contain an index file they will not see the contents of the directory but will instead get an error message. If your site is not configured this way you can prevent directory browsing by adding this simple line to your .htaccess file:

Create a Back Button

The basic code for a back button link is a very simple JavaScript. All you have to do with this back button JavaScript is copy the code and paste it where you want the back button link to show on your Web page.

<a href="javascript:history.go(-1)">Go Back</a>


PNG-Transparency for Windows IE 5.5 & 6

This plugin will fix the missing PNG-Transparency in Windows Internet Explorer 5.5 & 6.

Version 1.1, 2007-09-11

Tested on Windows XP SP2 with
– IE 5.5 + 6 + 7


* unobtrusive script, simple to setup
* works now also with CSS-Backgrounds (but scaling backgrounds)
* works with PNG-Images within Links
* TITLE, ALT, CLASS and STYLE-Attributes are considered

PHP: Getting the difference between two time strings

To get the difference between two time strings use this code


function timeDiff($firstTime,$lastTime)

// convert to unix timestamps

// perform subtraction to get the difference (in seconds) between times

// return the difference
return $timeDiff;

//Usage :
echo timeDiff("2002-04-16 10:00:00","2002-03-16 18:56:32");


Pin It on Pinterest