SchoolMart is a web application designed to simplify the process of managing book lists, schools, notifications, and book purchases. It connects users (parents), bookstores, and schools in one unified platform.
-
User Authentication & Authorization
Secure login and registration for three roles:User,School, andBookstore. Passwords are encrypted usingpassword_hash(). -
Book List Upload
Upload.xlsor.xlsxfiles via the UI (requires Python backend for processing Excel files). -
School Management
View a list of registered schools dynamically fetched from the database. -
Order Management
- Users can place orders for books.
- Orders start as
Pendingand can be accepted or rejected by bookstores.
-
Notifications System
Users receive real-time updates about their order status. -
MySQL Database Integration
All user, school, book, and order data is stored in a structured MySQL database.
- HTML5
- CSS3 (with
styles.cssand inline styles) - JavaScript
- PHP (for main server-side logic)
- Python (Flask app for Excel upload processing β optional)
- MySQL
- Create a database named
schoolmart.
CREATE DATABASE IF NOT EXISTS schoolmart;
USE schoolmart;
Import the schoolmart.sql file:
bash
Copy
Edit
mysql -u your_username -p schoolmart < schoolmart.sql
(Optional) If bookstores table is missing, create it:
sql
Copy
Edit
CREATE TABLE bookstores (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
phone VARCHAR(15),
address TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Update your db.php connection file:
php
Copy
Edit
$host = 'localhost';
$db = 'schoolmart';
$user = 'root';
$pass = '';
2. π₯οΈ Web Server Setup (PHP)
Place all files (PHP, HTML, CSS) inside your web server root (e.g., htdocs/schoolmart/).
Ensure PHP is installed and configured (Apache or Nginx with PHP-FPM).
3. π Python Backend for Excel Uploads (Optional)
The fff.html page sends uploads to http://localhost:5000/upload-booklist.
Sample Flask Backend (app.py):
python
Copy
Edit
from flask import Flask, request, jsonify
from flask_cors import CORS
import pandas as pd
app = Flask(__name__)
CORS(app)
@app.route('/upload-booklist', methods=['POST'])
def upload_booklist():
if 'booklist' not in request.files:
return jsonify({'error': 'No file part'}), 400
file = request.files['booklist']
if file.filename == '':
return jsonify({'error': 'No selected file'}), 400
if file and file.filename.endswith(('.xls', '.xlsx')):
try:
df = pd.read_excel(file)
print("Uploaded file preview:\n", df.head())
return jsonify({'message': 'Book list processed successfully!'}), 200
except Exception as e:
return jsonify({'error': str(e)}), 500
return jsonify({'error': 'Invalid file type'}), 400
if __name__ == '__main__':
app.run(port=5000, debug=True)
Install Dependencies:
bash
Copy
Edit
pip install Flask pandas openpyxl Flask-Cors
Run Server:
bash
Copy
Edit
python app.py
π Accessing the Application
Login Page: http://localhost/schoolmart/login.html
Registration: http://localhost/schoolmart/register.html
Upload Booklist: http://localhost/schoolmart/fff.html
π Usage
Register as a User, Bookstore, or School.
Login to access your role-specific dashboard.
Upload Excel files with book lists via fff.html (Python backend must be running).
Place Orders as a user (books, school, quantity).
Manage Orders as a bookstore (Accept/Reject orders).
Receive Notifications when order status changes.
π Project Structure
bash
Copy
Edit
schoolmart/
βββ buy_books.php # Handles book purchases
βββ db.php # Database connection
βββ fff.html # Upload book lists
βββ get_notifications.php # Fetch notifications
βββ load_schools.php # Load registered schools
βββ login.html # Login UI
βββ login.php # Login logic
βββ login.png # Background image
βββ place_order.php # Place orders with bookstore
βββ process_order.php # Bookstore updates orders
βββ register.html # Registration UI
βββ register.php # Registration logic
βββ schoolmart.sql # MySQL schema
βββ styles.css # CSS styles
βββ app.py (optional) # Flask backend for file uploads
π€ Contributors
Khushbu Poul (Project Owner)
Additional contributions welcome β feel free to fork and submit pull requests.
π License
This project is open-source and available under the MIT License.
yaml
Copy
Edit
---
Let me know if you'd also like a `LICENSE`, `.gitignore`, or want me to auto-generate and bundle t