Secure Application
A secure web application with PHP backend and JavaScript frontend featuring authentication, data management, and modern UI.
Features
- User registration and login with secure password handling
- CSRF protection
- SQL injection prevention (PDO prepared statements)
- XSS protection
- Real-time form validation
- Password strength requirements
- Show/hide password toggle
- Responsive dark theme UI
Tech Stack
- Backend: PHP 8+ with PostgreSQL
- Frontend: Vanilla JavaScript, HTML, CSS
- Database: PostgreSQL
Requirements
- PHP 8.0+
- PostgreSQL
- Node.js (for formatting/linting)
Setup
-
Install dependencies:
npm install composer install -
Configure database: Copy
.env.exampleto.envand update with your database credentials:DB_HOST=localhost DB_NAME=securecode DB_USER=your_username DB_PASSWORD=your_password DB_PORT=5432 -
Create database:
psql -h localhost -U your_username -d postgres -c "CREATE DATABASE securecode;" -
Run migrations:
psql -h localhost -U your_username -d securecode -f config/schema.sql -
Start development server:
php -S localhost:8000 -t public -
Access the app: http://localhost:8000
Development
- Format code:
npm run format - Lint code:
npm run lint
Project Structure
├── config/
│ ├── database.php # Database connection & helpers
│ └── schema.sql # Database schema
├── api/
│ └── index.php # API endpoints
├── public/
│ ├── index.php # Router
│ ├── views/ # Page templates
│ ├── js/ # JavaScript files
│ └── styles/ # CSS files
└── .env.example # Environment template
Password Requirements
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
Languages
PHP
40.4%
JavaScript
29.4%
CSS
24.3%
Hack
5.9%