A web-based location management system with QR code generation and route finding capabilities, designed for indoor navigation within the University of Beira Interior (UBI) campus.
- Location Management: Add, edit, and manage locations with descriptions and images
- Connection Network: Create connections between locations with distance information
- QR Code Generation: Automatically generate QR codes for each location for easy scanning
- Route Finding: Calculate shortest paths between locations using Dijkstra's algorithm
- Admin System:
- Multi-admin support with approval workflow
- Secure registration with reCAPTCHA verification
- Session-based authentication
- Interactive Interface:
- Browse locations and their connections
- Search functionality
- Image upload for location documentation
- Responsive design
- Backend: PHP with MySQLi
- Database: MySQL/MariaDB
- Frontend: HTML, CSS, JavaScript (jQuery)
- Libraries:
- phpqrcode - QR code generation
- Google reCAPTCHA - Form protection
- PHP 7.4 or higher
- MySQL 5.7+ or MariaDB 10.2+
- Web server (Apache/Nginx)
- Write permissions for the
uploads/directory
git clone https://github.com/RodrigDuarte/UBILocations.git
cd UBILocationsDownload and install the required PHP libraries:
cd WebServer/libs/
wget https://sourceforge.net/projects/phpqrcode/files/phpqrcode-2010100721_1.1.4.zip
unzip phpqrcode-2010100721_1.1.4.zip -d phpqrcode
rm phpqrcode-2010100721_1.1.4.zipOr download manually from: https://phpqrcode.sourceforge.net/
cd WebServer/libs/
git clone https://github.com/google/recaptcha.git recaptcha-masterCreate a MySQL database user and import the database schema:
# Create database user (run as MySQL root)
mysql -u root -pCREATE USER 'your_db_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON UBILocations.* TO 'your_db_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;Import the database schema from the provided SQL file:
mysql -u your_db_user -p < WebServer/DBCreate.sqlThe WebServer/DBCreate.sql file creates the database and all required tables:
admins- Administrator accountslocations- Location informationconnections- Connections between locationsuploads_locations- Images for locationsuploads_connections- Images for connections
Copy the example configuration file and update with your settings:
cd WebServer
cp connections.php.example connections.phpEdit connections.php with your database credentials and reCAPTCHA keys:
// Database connection information
$db_host = "localhost:3306";
$db_user = "your_db_user";
$db_password = "your_secure_password";
$db_name = "UBILocations";
// Google reCAPTCHA information
$domain = "your-domain.com";
$secret = "your_recaptcha_secret_key";Get your reCAPTCHA keys from: https://www.google.com/recaptcha/admin
Update register.php with your reCAPTCHA site key (line 145):
<div class="g-recaptcha" data-sitekey="your_recaptcha_site_key"></div>Update qr_codes.php with your domain (line 14):
$codeText = 'https://your-domain.com/location.php?scan='.$param;chmod 755 WebServer/uploads/
chmod 755 WebServer/uploads/locations/
chmod 755 WebServer/uploads/connections/Create a virtual host or add to your existing configuration:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /path/to/UBILocations/WebServer
<Directory /path/to/UBILocations/WebServer>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>server {
listen 80;
server_name your-domain.com;
root /path/to/UBILocations/WebServer;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}- Navigate to your domain in a web browser
- You'll be redirected to the registration page
- The first admin account is automatically approved
- Login and start adding locations!
- Login to the dashboard
- Fill in the location name and description
- Optionally upload images
- Click "Adicionar" to save
- Navigate to the connections page
- Select start and end locations
- Enter the distance and optional description
- Upload images if needed
- Save the connection
QR codes are automatically generated for each location and can be accessed via the locations page. Users can scan these codes to quickly navigate to location information.
- Go to the route page
- Select a start location
- Select a destination
- The system calculates the shortest path using Dijkstra's algorithm
- View step-by-step navigation instructions
UBILocations/
├── WebServer/
│ ├── index.php # Entry point
│ ├── login.php # Authentication
│ ├── register.php # User registration
│ ├── dashboard.php # Main admin panel
│ ├── location.php # Location viewer
│ ├── location_editor.php # Location management
│ ├── connections.php # Database configuration
│ ├── connection_editor.php # Connection management
│ ├── route.php # Route finding
│ ├── qr_codes.php # QR code generator
│ ├── administration.php # Admin approval
│ ├── functions.php # Utility functions
│ ├── include/ # Common includes
│ ├── libs/ # External libraries
│ ├── scripts/ # JavaScript files
│ ├── styles/ # CSS stylesheets
│ ├── res/ # Resources
│ └── uploads/ # User uploads
└── README.md
- All passwords are hashed using
password_hash()with bcrypt - Prepared statements are used to prevent SQL injection
- reCAPTCHA protects against automated registration
- Session-based authentication
- Admin approval workflow for new accounts
- Important: Never commit
connections.phpwith real credentials to version control
- phpqrcode by Dominik Dzienia
- Google reCAPTCHA
- Dijkstra's algorithm implementation by zairwolf
- University of Beira Interior