Technical skills turns into complexity and creativity turns into simplicity.
25 September 2008
PHP Code - Forcefully Download A file
//header('Content-Type: application/pdf');
if($_GET['fol']=='pdf')
{
$filename = "desa/".$_GET['name'];
header('Content-Type: application/pdf');
}
else
{
$filename = "ppt/".$_GET['name'];
header('Content-Type: application/ppt');
}
if(isset($_GET['name1']) and $_GET['name1']='archives')
{
$filename = "archives/".$_GET['name'];
header('Content-Type: application/pdf');
}
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.");
?>
if($_GET['fol']=='pdf')
{
$filename = "desa/".$_GET['name'];
header('Content-Type: application/pdf');
}
else
{
$filename = "ppt/".$_GET['name'];
header('Content-Type: application/ppt');
}
if(isset($_GET['name1']) and $_GET['name1']='archives')
{
$filename = "archives/".$_GET['name'];
header('Content-Type: application/pdf');
}
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.");
?>
01 September 2008
How to hid PHP from visitor?
In general, security by obscurity is one of the weakest forms of security. But in some cases, every little bit of extra security is desirable.
A few simple techniques can help to hide PHP, possibly slowing down an attacker who is attempting to discover weaknesses in your system. By setting expose_php = off in your php.ini file, you reduce the amount of information available to them.
Another tactic is to configure web servers such as apache to parse different filetypes through PHP, either with an .htaccess directive, or in the apache configuration file itself. You can then use misleading file extensions:
Subscribe to:
Posts (Atom)