|
Posted by James Barrett on 10/06/07 15:50
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
AlBen wrote:
> Hello guys
>
> I have a problem with my site
> I need a anti leech php script code
>
> I need to protect some external links on my pages
> I would like to find a simple script which will check from where are
> coming the request
> from my page or not.
>
> Thank you
>
Hi, I think I know what you are asking. If you have an index.php that
includes some other php file, (lets call it test.php) then in test.php,
you could test $_SERVER['PHP_SELF'] == '/index.php'. and if that fails,
you know someone is attempting to use test.php directly. if it passes,
you know it is from your index.php.
for example, your index.php would have something like this:
<?php
include_once('test.php');
?>
and then test.php would have something like this:
<?php
if($_SERVER['PHP_SELF'] != '/index.php')
{
die(' you leach!!!');
}
else
{
echo 'very good';
}
?>
try that out and let me know if that is what you are looking for.
Jim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHB67NQuDJiZ/QrH0RAgIaAJ4hU2N8i3nYS24SjEOs83a712Ff6ACgyLcX
0pYazvgFUzg5LypIKULOdFc=
=pbi9
-----END PGP SIGNATURE-----
Navigation:
[Reply to this message]
|