A PHP-based application for detecting and logging bot activity on your website. This project utilizes CrawlerDetect to differentiate between human users and crawlers, storing relevant data in a MySQL database.
- Detects various web crawlers and bots using the CrawlerDetect library.
- Logs bot activity with relevant details such as IP address, user agent, domain name, full path, and check value.
- Sends email notifications to the admin when a bot is detected.
- Stores data in a MySQL database for easy retrieval and analysis.
- PHP 7.0 or higher
- MySQL
- Composer (for installing dependencies)
- A web server (Apache/Nginx) configured to run PHP
Make sure you have Composer installed, then run:
composer install
- install CrawlerDetect
You need to install the CrawlerDetect library using Composer:
composer require jaybizzle/crawler-detect
Create a MySQL database and run the SQL commands. Look in the info.txt
file to create the necessary tables
Update the config/config.php
file with your database connection details and admin email address.
Make sure your web server is configured to serve the public
directory. You may need to adjust the document root settings.
Open your web browser and navigate to your server's URL followed by /stat.php
to start monitoring bot activity.
You can test your project by running the server:
php -S localhost:8000 -t public
Once set up, the application will automatically log bot visits to the bot_data
table in the database and send email notifications when a bot is detected.
Logs are stored in the logs/bot-analytics.log
file. You can check this file for any errors or additional information about the bot detections.
CrawlerDetect The web used library for this project.