Forum Moderators: coopster

Message Too Old, No Replies

paths in php files

php bot traps path descriptions

         

revrob

11:12 pm on Sep 23, 2007 (gmt 0)

10+ Year Member



I am trying to insert a bot trap in a location that is visited by hacker bots and get it to write an IP to the .htaccess file.
The bottrap.php file calls a "bottrap-script" in the root directory where .htaccess is and this script writes the IP of the hacker to the .htaccess file and sends me an email.

the trap works if it is in the root, but I can't work out how to adjust the path statement to call the script in the root, from a bottrap in a different directory. As I have some bots who go direct to certain locations rather than "crawling" the site, I can only trap them by putting renamed trap files in that location.

The path of the root directory for my pages in the site is given in the logs as
/var/www/vhosts/mydomain/httpdocs/
and .htaccess and the script (bottrap-script.php) are in that httpdocs directory.

The bot trap is here
/var/www/vhosts/mydomain/httpdocs/WebCalendar/ws/bottrap.php (renamed as appropriate)

The statement in the bot trap I need to rewrite (if it is possible to include the php equivalent of a path) is

<?php
include 'bottrap-script.php';
?>

I am brand new to php scripts and bot traps and ftp server work, having had my site hacked and my domain host server crashed a fortnight ago by a vulnerability in an older version of WebCalendar - which the bots are still visiting and looking for- hence the strategy. I have a newer version of the app. in a different location.
Many thanks in advance for any help.

PHP_Chimp

7:34 am on Sep 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can include relative paths within your include statement i.e.
include '../../path/to/script.php';

So long as you have permission to access that path then you can include it. If you dont have permission then I think that you get a warning, something along the lines of 'safe mode restriction in place', you will also get the warning that the include statement failed.

revrob

8:44 am on Sep 24, 2007 (gmt 0)

10+ Year Member



Many thanks for the prompt response. Prior to reading it, I did things slightly differently, as I found a way of stating the path to the .htaccess file in the trap-script, so now each folder I want to booby trap has a calling file with a name that I know the bots have been looking for, and the trap-script in the same folder, and the script has the path to the .htaccess file in the root, and it is all now working. Now to wait and see if the fish are biting!