try this,
PHP Code:
<html>
<head>
<title>Test</title>
<?php
session_start();
$_SESSION['insite'] = true;
function quitInsite()
{
unset($_SESSION['insite']);
}
if (!defined('SHUTDOWN_REGISTERED')) // *_once, this shouldn't be necessary
{
register_shutdown_function('quitInsite');
define('SHUTDOWN_REGISTERED', true);
}
?>
<link rel="stylesheet" type="text/css" href="hide.php?type=css&serve=css_test"/>
<script type="text/javascript" src="hide.php?type=css&serve=js_test">
</head>
<body>
</body>
</html>
PHP Code:
<?php
session_start();
if (isset($_SESSION['insite']))
{
$sPath = '';
switch(@$_GET['type'])
{
case 'css':
header('Content-type: text/css');
$sPath = 'Excss/' . @$_GET['serve'] . '.css';
break;
case 'js':
header('Content-type: text/js');
$sPath = 'Exjs/' . @$_GET['serve'] . '.js';
break;
}
// sPath should be a non-published directory
$fp = @fopen($sPath, 'r');
if ($fp)
{
fpassthru($fp);
fclose($fp);
}
}
?>
Bookmarks