CYBERCAFE MANAGEMENT SYSYTEM PROJECT REPORT Submitted in partial fulfillment of the requirements for the award of CLASS XII By MOHAMED SHAH SHAJIR (Reg No: _________________) ST. JOSEPH’S CENTRAL SCHOOL (Affiliated to CBSE Delhi) MUNDAKAYAM KOTTAYAM – 686513 Academic Year 2023-2024 ST. JOSEPH’S CENTRAL SCHOOL (Affiliated to CBSE Delhi) MUNDAKAYAM KOTTAYAM– 68 65 13 BONAFIDE CERTIFICATE This is to certify that the main project, titled “CYBERCAFE MANAGEMENT SYSTEM” by MOHAMED SHAH SHAJIR (REG NO: _______________________), submitted in partial fulfilment of the requirement for the award of CLASS XII, is a bonafide work carried him under supervision, during the academic year 2023-2024. GUIDE PRINCIPAL EXAMINER ACKNOWLEDGEMENT First of all, I am grateful to The Almighty God for His blessings which helped me to successfully complete this project. I wish to express my sincere thanks to our principal, FR. THOMAS NALANNADIYIL,for providing the ambiance for carrying out this work. I place on record my sincere gratitude to Mrs. ASWATHY P. ,teacher of the Department of Computer Science, for her guidance, constant supervision as well as encouragement. I take this opportunity to record my sincere thanks to all the teaching and non-teaching faculty members of Department of Computer Science for providing their valuable assistance and instant help. Finally, I would like to express my sense of gratitude to my family and friends, for helping me survive all the stress and not letting me give up, and to one and all who, directly or indirectly, have lent their helping hand in this venture. INDEX 1. OVERVIEW 2. ENVIRONMENTAL SPECIFICATIONS 3. SOFTWARE DESCRIPTION 4. INTRODUCTION TO PYTHON DATABASE CONNECTIVITY 5. LIST OF TABLES 6. MODULE DESCRIPTION 7. SOURCE CODE 8. OUTPUT 9. CONCLUSION 10. REFERENCE OVERVIEW A cybercafe management system is a software solution designed to streamline and organize the operations of a cybercafe or internet cafe. It typically includes features such as user authentication, time and usage tracking, billing and payment management, computer reservation systems, and security measures. Provide insights for cafe administrators. This system aims to enhance efficiency, user experience, and overall management of a cybercafe through a Python-based application with features ranging from authentication to billing and reporting. ENVIRONMETAL SPECIFICATIONS 1. Programming Language: Python: Use Python as the primary programming language for its readability, versatility, and extensive libraries. 2. Web Framework: Flask: Choose Flask for its simplicity and flexibility, making it well-suited for web development in Python. 3. Database: MySQL: Utilize MySQL as the relational database management system to store user data, session information, and billing details. 4. Front-End Technologies: HTML, CSS, JavaScript: Use standard web technologies to create a user-friendly and interactive web interface. 5. Database Connector: MySQL Connector for Python (mysql-connector-python): This library facilitates communication between Python and MySQL, allowing seamless interaction with the database. 6. Security: Hashing Algorithms: Use secure password hashing algorithms (e.g., bcrypt) to store and manage user passwords securely. 7. Payment Integration (Optional): Payment Gateway API: If handling payments, integrate a secure payment gateway API compatible with Python and Flask. 8. Operating System: Cross-Platform Compatibility: Develop the system to be compatible with various operating systems, ensuring broad usability. 9. Hosting: Cloud Hosting Services (Optional): Consider hosting the application on cloud platforms like AWS, Azure, or Google Cloud for scalability and reliability. 10. Development Environment: IDE (Integrated Development Environment): Use popular Python IDEs like PyCharm or VSCode for efficient coding and debugging. 11. Version Control: Git: Implement version control using Git for collaborative development and code management. 12. Documentation: Sphinx or MkDocs: Utilize documentation tools like Sphinx or MkDocs to maintain comprehensive project documentation. SOFTWARE DESCRIPTION Python: Python is a versatile, high-level programming language. In this system, Python is the core language for server-side scripting and overall application development. Flask:Flask is a lightweight web framework for Python. It simplifies web development by providing tools for handling routes, views, and interactions between the client and server. Flask is chosen for its simplicity and flexibility. MySQL: MySQL is a widely used open-source relational database management system. In the Cybercafe Management System, MySQL stores and manages structured data, including user information, session details, and billing records. HTML, CSS, JavaScript: HTML (Hypertext Markup Language) is used for creating the structure of web pages. CSS (Cascading Style Sheets) is employed for styling and layout. JavaScript adds interactivity to the user interface, enhancing the overall user experience. MySQL Connector for Python (mysql-connector-python): This is a Python library that facilitates communication between the Python application and the MySQL database. It allows the application to interact with the database, retrieve data, and perform database operations. Hashing Algorithms (e.g., bcrypt): Hashing algorithms are used for secure password storage. Bcrypt, for example, is a strong, one-way hashing function that protects user passwords by converting them into a hash that is difficult to reverse. Payment Gateway API: If integrated, a Payment Gateway API handles payment transactions securely. It allows the system to process payments for services provided in the cybercafe. Operating System: The software is developed to be compatible with various operating systems, ensuring that it can run on different platforms and reach a broader user base. Cloud Hosting Services (AWS, Azure, Google Cloud): Cloud hosting services provide infrastructure for deploying and hosting the application. They offer scalability, reliability, and accessibility over the internet. IDE (Integrated Development Environment): An Integrated Development Environment is a software application that provides comprehensive tools for coding, debugging, and managing projects. Examples include PyCharm and VSCode. Git: Git is a version control system that tracks changes in the source code during development. It enables collaboration among developers and helps manage different versions of the software. Documentation Tools (Sphinx, MkDocs): Documentation tools like Sphinx or MkDocs are used to create and maintain project documentation. They assist in providing detailed information for developers and users. These software components collectively contribute to the development, security, and functionality of the Cybercafe Management System. INTRODUCTION TO PYTHON DATABASE CONNECTIVITY Python Database Connectivity plays a crucial role in managing and storing data related to user sessions, billing, reservations, and more. The integration of Python with a relational database, such as MySQL, facilitates the seamless handling of information critical to the cybercafe's operations. Key Components in the Cybercafe Management System: 1. Python: Python serves as the primary programming language for the Cybercafe Management System, providing flexibility and ease of development. 2. MySQL: MySQL is chosen as the relational database management system to store and organize structured data. It acts as the repository for user details, session information, billing records, and other relevant data. 3. mysql-connector-python: The mysql-connector-python library is utilized to establish a connection between the Python application and the MySQL database. This connector enables seamless communication, allowing Python to execute SQL queries and retrieve or manipulate data. Basic Steps in Python Database Connectivity for Cybercafe Management: 1. Importing Necessary Libraries: Begin by importing the required libraries, including mysql.connector, to enable Python's interaction with the MySQL database. import mysql.connector 2. Establishing a Connection: Define connection parameters, such as host, user, password, and database, to establish a connection to the MySQL server. connection = mysql.connector.connect(host="your_host",user="your_user", password="your_password",database="your_database") 3. Creating a Cursor: Create a cursor, which is a database cursor object used to execute SQL queries and interact with the database. cursor = connection.cursor() 4. Executing SQL Queries: Utilize the cursor to execute SQL queries specific to the Cybercafe Management System. This may include queries for user authentication, session tracking, billing calculations, and more. # Example: Execute a SELECT query for user authentication cursor.execute("SELECT * FROM users WHERE username = %s AND password = %s", (username, password)) 5. Committing Changes and Closing Connection: After executing queries and making changes to the database, commit those changes and close the database connection. # Commit changes connection.commit() # Close the connection connection.close() Python's Database Connectivity is fundamental in ensuring that the Cybercafe Management System can efficiently store, retrieve, and manage data, ultimately enhancing the system's performance and user LIST OF TABLES 1. Users Table: Purpose: Stores information about registered users. Fields: User ID, Username, Password (hashed), Email, Registration Date, etc. 2. Sessions Table: Purpose: Records details about user sessions in the cybercafe. Fields: Session ID, User ID (foreign key), Start Time, End Time, Duration, Computer ID (if applicable), etc. 3. Billing Table: Purpose: Manages billing information for user sessions. Fields: Billing ID, Session ID (foreign key), Amount, Payment Status, Payment Date, etc. 4. Computers Table: Purpose: Stores information about the computers available in the cybercafe. Fields: Computer ID, Status (available, reserved, in use), Specifications, etc. 5. Reservations Table: Purpose: Manages user reservations for specific computers and times. Fields: Reservation ID, User ID (foreign key), Computer ID (foreign key), Reserved Date and Time, Status, etc. 6. Logs Table: Purpose: Maintains a log of system activities and events. Fields: Log ID, Timestamp, User ID (if applicable), Activity Description, etc. 7. Admins Table: Purpose: Stores information about administrators or staff members. Fields: Admin ID, Username, Password (hashed), Email, Role, etc. These tables are interconnected using primary and foreign keys to establish relationships between different entities. For instance, the User ID in the Sessions table can be a foreign key referencing the Users table. MODULE DESCRIPTION 1. mysql.connector: Description: This module is part of the MySQL Connector/Python, which is a MySQL driver for Python. It enables Python programs to connect to and interact with MySQL databases. Role in Cybercafe Management System: The mysql.connector module is used to establish a connection between the Python application and the MySQL database. It provides methods for executing SQL queries, managing transactions, and handling the flow of data between the application and the database. 2. python-dotenv: Description: The python-dotenv module allows loading environment variables from a .env file, which can be useful for storing sensitive information like database credentials. Role in Cybercafe Management System: It enhances security by providing a way to manage and load sensitive information, such as database connection details, from a separate configuration file (.env). 3. flask: Description: Flask is a lightweight web framework for Python. It simplifies web development by providing tools for handling routes, views, and interactions between the client and server. Role in Cybercafe Management System: Flask serves as the foundation for developing the web-based interface of the Cybercafe Management System. It handles user requests, communicates with the database, and renders dynamic web pages. 4. flask-mysqldb: Description: flask-mysqldb is an extension for Flask that simplifies MySQL integration by providing a MySQL connection and cursor within the Flask application context. Role in Cybercafe Management System: This module streamlines MySQL connectivity within a Flask application, making it easier to manage database connections, execute queries, and handle transactions. 5. bcrypt: Description: The bcrypt module is used for secure password hashing. It employs a strong, one-way hashing function to protect sensitive information like user passwords. Role in Cybercafe Management System: bcrypt ensures the secure storage of user passwords in the database, adding a layer of protection against unauthorized access. 6. datetime: Description: The datetime module provides classes for working with dates and times in Python. Role in Cybercafe Management System: It is used to manage timestamps, record session start and end times, and calculate session durations accurately. 7. json: Description: The json module allows encoding and decoding JSON data, which is often used for exchanging data between the frontend and backend of web applications. Role in Cybercafe Management System: It can be used to format and transmit data between the server and the web interface in a structured and readable manner. These Python modules collectively contribute to the development and functionality of the Cybercafe Management System by providing essential tools for database connectivity, web development, security, and data management. SOURCE CODE 1. Update app/templates/login.html: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login</title> </head> <body> <h1>Login</h1> {% with messages = get_flashed_messages() %} {% if messages %} <ul class="flash-messages"> {% for message in messages %} <li>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endwith %} <form method="post" action=""> {{ form.csrf_token }} <label for="username">Username:</label> {{ form.username }} <label for="password">Password:</label> {{ form.password }} {{ form.submit }} </form> <p>Don't have an account? <a href="{{ url_for('register') }}">Register</a></p> </body> </html> 2. Update app/templates/register.html: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Register</title> </head> <body> <h1>Register</h1> {% with messages = get_flashed_messages() %} {% if messages %} <ul class="flash-messages"> {% for message in messages %} <li>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endwith %} <form method="post" action=""> {{ form.csrf_token }} <label for="username">Username:</label> {{ form.username }} <label for="password">Password:</label> {{ form.password }} {{ form.submit }} </form> <p>Already have an account? <a href="{{ url_for('login') }}">Login</a></p> </body> </html> 3. Create app/templates/base.html for a common layout: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{% block title %}{% endblock %}</title> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> </head> <body> <div class="container"> {% block content %}{% endblock %} </div> </body> </html> 4. Update app/templates/home.html to extend the base layout: html {% extends 'base.html' %} {% block title %}User List{% endblock %} {% block content %} <h1>User List</h1> <p>Welcome, {{ current_user.username }}!</p> <ul> {% for user in users %} <li>{{ user.username }}</li> {% endfor %} </ul> <p><a href="{{ url_for('logout') }}">Logout</a></p> {% endblock %} 5. Update app/routes.py to handle session management: ```python from flask import render_template, redirect, url_for, flash from flask_login import current_user, login_user, logout_user, login_required from app import app, db from app.forms import LoginForm, RegistrationForm from app.models import User @app.route('/') @login_required def home(): users = User.query.all() return render_template('home.html', users=users) @app.route('/login', methods=['GET', 'POST']) def login(): if current_user.is_authenticated: return redirect(url_for('home')) form = LoginForm() if form.validate_on_submit(): user = User.query.filter_by(username=form.username.data).first() if user and user.check_password(form.password.data): login_user(user) flash('Login successful!', 'success') return redirect(url_for('home')) else: flash('Login failed. Check your username and password.', 'danger') return render_template('login.html', form=form) @app.route('/logout') @login_required def logout(): logout_user() flash('You have been logged out.', 'info') return redirect(url_for('login')) @app.route('/register', methods=['GET', 'POST']) def register(): if current_user.is_authenticated: return redirect(url_for('home')) form = RegistrationForm() if form.validate_on_submit(): user = User(username=form.username.data) user.set_password(form.password.data) OUTPUT CONCLUSION The Cybercafe Management System project represents a comprehensive solution for efficiently managing and organizing cybercafe operations. This project encompasses key aspects of software development, database management, and user interaction. The system incorporates features such as user authentication, session management, user registration with password hashing, and a user-friendly interface. The project not only demonstrates practical implementation skills in web development using Flask, Python, and MySQL but also addresses fundamental considerations in cybersecurity, including password hashing for user protection. It provides a foundational structure that can be further expanded and customized based on specific cybercafe requirements. Moreover, the project highlights the importance of integrating various technologies to create a cohesive and functional solution. Through the use of Flask for web development, MySQL for database management, and additional libraries for enhanced functionality, the Cybercafe Management System showcases the versatility and applicability of computer science principles in real-world scenarios. As an ongoing endeavor, the project can be extended to include advanced features, improved user interfaces, and additional security measures. It serves as a practical and educational example, demonstrating the application of computer science concepts to address real-world challenges in managing cybercafe environments. REFERENCE