This is a fast PHP project focused on tracking the user's IP, device, ISP, and location (GPS and exact street) smoothly before redirecting them to a final destination.
The system uses background asynchronous processing (native PHP Fire-and-forget) to avoid blocking navigation and parses the GPS using the free public API of OpenStreetMap (Nominatim).
To run this project on your hosting server, you need:
- PHP 8.0 or higher.
pdo_sqliteandcurlextensions enabled.- Terminal/shell (SSH) access to install packages via Composer.
Upload all files to your server. For security, the data/ and src/ folders should ideally be placed one level above your web server's public folder (e.g., public_html or www), meaning your domain should point exclusively to the public/ folder of this project.
The project requires Composer.
How to install Composer: If you already have Composer installed globally, just run this in the project root:
composer installIf your hosting (e.g., cPanel, HostGator, Hostinger) does not have Composer globally accessible, you can download the local executable into the project folder:
# Downloading Composer locally
wget https://getcomposer.org/composer.phar
# Or using curl
curl -O https://getcomposer.org/composer.phar
# Installing dependencies
php composer.phar install(Note: Different shared hosting services might have different PHP commands or paths, like /usr/local/bin/php. Check your hosting documentation if the php command is not recognized).
The system automatically creates an SQLite database in the data/ folder. You must ensure the folder has write permissions for the web server user (usually www-data on Ubuntu/Debian):
chmod -R 775 data/All incoming traffic goes through the main public route. The redirection is controlled via query string.
Example URL:
https://yoursite.com/?target=https://final-destination.com
- The user visits the link above.
- The page loads a "Please wait..." screen and triggers a Location (GPS) permission request in the user's browser.
- At the same time, in the background, the PHP server triggers the query that captures IP and Device information, creating the
v_UNIQUE_IDrecord instantly. - If the user clicks Allow, the exact coordinates hit the
location.phpfile, the system translates (Geocoding) the latitude and longitude to get the Street, Neighborhood, and City on OpenStreetMap and updates the SQLite database. - The redirection to the original link occurs instantly. If the user denies the popup permission, after a timeout they will also be redirected without losing the IP data.
All captured data is saved in a lightweight database called tracker.sqlite inside the data/ folder.
Accessing data via Terminal (SSH):
If you want to read the results directly from the terminal, use the sqlite3 tool:
cd data/
sqlite3 tracker.sqlite "SELECT ip, device, city, latitude, longitude, street_address FROM visits;"Exporting or reading via Interface:
If you prefer, since SQLite is just a file (tracker.sqlite), you can download it via FTP/SFTP to your personal computer and open it using visual programs like:
- DB Browser for SQLite
- DBeaver
- VS Code Extensions (e.g., SQLite Viewer)
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
This project is licensed under the MIT License - see the LICENSE file for details.