I have scripts and styles on ym page that I don't want anyone to be able to see. I was wondering if I could hide it so that when I want a style I could use something like this:
<link href="content.php?style" type=text/css rel=stylesheet>
and I can set where that is in the code so I could have the sheet somewhere like /garble/hounddog/super.css or /hunnybunchesofoats.css or anything like that, same with all my javascript except like this:
<script src="content.php?js" type="text/javascript"></script>
My current code from a hotlinking prevention page:
Can anyone show me how to modify that? All the header info is confusing me.PHP Code:<?php
$dir='./';
if ((!$file=realpath($dir.$_GET['file']))
|| strpos($file,realpath($dir))!==0 || substr($file,-4)=='.php'){
header('HTTP/1.0 404 Not Found');
exit();
}
$ref=$_SERVER['HTTP_REFERER'];
if (strpos($ref,'http://localhost/')===0 || strpos($ref,'http')!==0){
$mime=array(
'jpg'=>'image/jpeg',
'png'=>'image/png',
'mid'=>'audio/x-midi',
'wav'=>'audio/x-wav'
);
$stat=stat($file);
header('Content-Type: '.$mime[substr($file,-3)]);
header('Content-Length: '.$stat[7]);
header('Last-Modified: '.gmdate('D, d M Y H:i:s',$stat[9]).' GMT');
readfile($file);
exit();
}
header('Pragma: no-cache');
header('Cache-Control: no-cache, no-store, must-revalidate');
if($_SERVER['QUERY_STRING'] == "style")
{
include($file.'.php');
}
?>
Thanks



Reply With Quote
Bookmarks