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
</filesMatch>

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:
(more…)

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

Source: http://jquery.andreaseberhard.de/pngFix/
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

pngFix

Features
* 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
(more…)

PHP: Getting the difference between two time strings

To get the difference between two time strings use this code

<?php

function timeDiff($firstTime,$lastTime)
{

// convert to unix timestamps
$firstTime=strtotime($firstTime);
$lastTime=strtotime($lastTime);

// perform subtraction to get the difference (in seconds) between times
$timeDiff=$lastTime-$firstTime;

// return the difference
return $timeDiff;
}

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

?>
Page 21 of 24«18192021222324

Pin It on Pinterest