Lightweight Network Management web application (local development)
NetAdmin Pro provides inventory management, IPAM, topology, incident tracking, reports, and user/role management for network operations teams.
- Start PHP built-in server from project root:
php -S localhost:8000 -t public- Open http://localhost:8000/login.php and sign in (default admin created during setup):
- Username:
admin - Password:
12345(change immediately)
- Import schema / create admin (if needed):
php scripts/import_schema.php
php scripts/create_admin.php --password='YourStrongPassword'- Update database credentials in
config/database.phpor use environment variablesDB_HOST,DB_NAME,DB_USER,DB_PASS. - Change the admin password after first login.
To create a remote repository and push from this folder:
git remote add origin git@github.com:<your_user>/<repo>.git
git branch -M main
git push -u origin main
```# NetAdmin Pro
NetAdmin Pro is an enterprise-style network management system built with PHP, MySQL, Bootstrap 5, and modern frontend patterns.
## Overview
This project is designed for network administrators, NOC engineers, and system administrators to manage network devices, IP address assignments, topology, incidents, reports, and user roles in a central dashboard.
## Structure
- `assets/` — frontend assets: CSS and JavaScript
- `config/` — database and configuration files
- `includes/` — shared PHP templates and helper functions
- `modules/` — feature modules for future expansion
- `public/` — web entry points and dashboard pages
- `sql/` — database schema and setup scripts
## Setup
1. Install XAMPP or another PHP/MySQL environment.
2. Place the `NetAdmin` folder in your Apache web root or configure your virtual host.
3. Create the database:
- Import `sql/schema.sql` into MySQL.
4. Add an admin user manually using a secure password hash.
5. Open `public/login.php` in your browser.
## Notes
- The project uses prepared statements and session-based authentication.
- The UI is designed for professional network operations dashboards.
- Device Management is implemented with inventory listing and add-device support.
- IP Address Management is implemented with subnet inventory and subnet creation.
- Subnet Calculator is implemented for network planning and mask calculations.
- Network Topology is implemented with a visual topology map and link inventory.
- Alerts & Incident Management is implemented with incident logging, severity tracking, and status reporting.
- Reports module is implemented with executive summaries, device and incident dashboards, and IPAM utilization metrics.
- Next development steps: add role-based user administration and advanced report export options.
## Deployment & Admin Setup
1. Import the database schema found in `sql/schema.sql` into MySQL/MariaDB.
2. Create an initial administrator account using the included CLI helper:
```bash
php scripts/create_admin.php --password="YourSecurePassword"- Place the
NetAdminfolder in your web server document root or configure a virtual host pointing topublic/. - Ensure
config/database.phpcontains correct DB credentials and that PHP sessions are writable.
Local setup helper commands
- Copy
.env.exampleto.envand update values. - Install PHP dependencies:
composer install- Import the database schema (either with
mysqlor the provided CLI helper):
# Using mysql CLI
mysql -u root -p netadmin_pro < sql/schema.sql
# Or using the project's PHP helper (reads DB config from environment or config)
php scripts/import_schema.php- Create an initial administrator account:
php scripts/create_admin.php --password="YourSecurePassword"Production hardening checklist
- Use HTTPS: configure TLS on your web server and set
SESSION_SECURE=1in.envto force secure session cookies. - Secure cookies:
includes/auth.phpappliesHttpOnlyand configurableSameSite(Laxdefault). SetSESSION_SAMESITE=Strictif appropriate. - Environment variables: move DB and SMTP credentials into
.envor your host's secret store; do not commit secrets. - PHP settings: disable
display_errorsand enablelog_errorsinphp.inifor production. - File permissions: ensure
exports/is writable by the scheduled user, but not world-writable. - Email credentials: configure SMTP in
.envand verifyphpmaileris working.
Quick Windows setup
Use the included helper to automate install, import, admin creation, and QA checks:
.\setup.batLinux / macOS setup
Use the included setup.sh helper (make it executable first):
chmod +x setup.sh
./setup.shEnvironment validation
Before running install helpers you can validate your system with:
php scripts/check_env.phpSecurity notes:
- CSRF protection is implemented for all POST forms via helpers in
includes/functions.php. - Role-based access control (RBAC) is enforced on management pages using
require_role()inincludes/auth.php.
Next recommended steps to harden before production:
- Configure HTTPS and secure cookies in
php.ini/ web server. - Use environment variables for DB credentials instead of committing them to config files.
- Review and enable appropriate PHP hardening options (disable display_errors, enable strict types where feasible).
Reports can be exported from the UI on the Reports page. Supported modes:
- Printable / PDF: click "Printable / PDF" then use the browser Print -> Save as PDF flow.
- CSV export: click "Export CSV" to download a CSV summary of device, incident, IPAM and topology metrics.
Server-side CSV export endpoint: public/reports_export.php?mode=csv
Automated QA helper:
Run the included QA script to scan public/ pages for missing CSRF tokens, RBAC checks, and basic PHP lint errors:
php scripts/qa_check.phpIf the script reports missing CSRF or RBAC entries, review the indicated files and ensure forms include <?php echo csrf_input_field(); ?> and pages enforce require_role() or require_login().
A simple scheduler script is provided at scripts/reports_cron.php. It writes timestamped CSV reports into the exports/ folder and can optionally email the CSV.
Basic usage (generate and save CSV):
php scripts/reports_cron.php --dir=exportsEmail the generated CSV (best-effort; requires a working PHP mail setup):
php scripts/reports_cron.php --dir=exports --email=ops@example.comCron example (Linux): run daily at 02:00
0 2 * * * /usr/bin/php /path/to/NetAdmin/scripts/reports_cron.php --dir=/path/to/NetAdmin/exportsTask Scheduler example (Windows): create a basic task that runs php.exe with argument C:\path\to\NetAdmin\scripts\reports_cron.php --dir=C:\path\to\NetAdmin\exports.
Files are written to the exports/ directory by default. Ensure the web server or scheduled user has write permission to that folder.
SMTP / PHPMailer setup
For reliable email delivery install Composer dependencies and configure SMTP credentials as environment variables or in your system's service configuration:
- Install Composer dependencies (run in project root):
composer install- Configure environment variables (example):
export SMTP_HOST=smtp.example.com
export SMTP_PORT=587
export SMTP_USER=smtp-user
export SMTP_PASS='smtp-password'
export SMTP_SECURE=tls
export MAIL_FROM=no-reply@example.com
export MAIL_FROM_NAME="NetAdmin Pro"On Windows Task Scheduler, set these as environment variables or include them in the scheduled task command.
Admin settings are also available through the app UI at Settings once you are logged in as an administrator. SMTP values entered there will be used if no environment variable override is present.