Skip to content

RodrigDuarte/UBILocations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

UBILocations - Location Management & Navigation System

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.

Features

  • 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

Technology Stack

  • Backend: PHP with MySQLi
  • Database: MySQL/MariaDB
  • Frontend: HTML, CSS, JavaScript (jQuery)
  • Libraries:

Requirements

  • PHP 7.4 or higher
  • MySQL 5.7+ or MariaDB 10.2+
  • Web server (Apache/Nginx)
  • Write permissions for the uploads/ directory

Installation

1. Clone the Repository

git clone https://github.com/RodrigDuarte/UBILocations.git
cd UBILocations

2. Install Required Libraries

Download and install the required PHP libraries:

phpqrcode

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.zip

Or download manually from: https://phpqrcode.sourceforge.net/

Google reCAPTCHA

cd WebServer/libs/
git clone https://github.com/google/recaptcha.git recaptcha-master

3. Database Setup

Create a MySQL database user and import the database schema:

# Create database user (run as MySQL root)
mysql -u root -p
CREATE 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.sql

The WebServer/DBCreate.sql file creates the database and all required tables:

  • admins - Administrator accounts
  • locations - Location information
  • connections - Connections between locations
  • uploads_locations - Images for locations
  • uploads_connections - Images for connections

4. Configuration

Copy the example configuration file and update with your settings:

cd WebServer
cp connections.php.example connections.php

Edit 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;

5. Set Permissions

chmod 755 WebServer/uploads/
chmod 755 WebServer/uploads/locations/
chmod 755 WebServer/uploads/connections/

6. Web Server Configuration

Apache

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>

Nginx

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;
    }
}

7. First Run

  1. Navigate to your domain in a web browser
  2. You'll be redirected to the registration page
  3. The first admin account is automatically approved
  4. Login and start adding locations!

Usage

Adding Locations

  1. Login to the dashboard
  2. Fill in the location name and description
  3. Optionally upload images
  4. Click "Adicionar" to save

Creating Connections

  1. Navigate to the connections page
  2. Select start and end locations
  3. Enter the distance and optional description
  4. Upload images if needed
  5. Save the connection

Generating QR Codes

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.

Finding Routes

  1. Go to the route page
  2. Select a start location
  3. Select a destination
  4. The system calculates the shortest path using Dijkstra's algorithm
  5. View step-by-step navigation instructions

Project Structure

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

Security Considerations

  • 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.php with real credentials to version control

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors