GithubHelp home page GithubHelp logo

ifsvivek / dbms-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 136 KB

4th Sem DBMS Project: Quiz Application

Home Page: https://ifsvivek.github.io

License: MIT License

Python 48.05% CSS 0.23% JavaScript 0.58% HTML 51.14%
dbms dbms-project flask python

dbms-project's Introduction

Quiz Application

This project is a web-based quiz application built with Flask and TailwindCSS. It allows users to log in as either an admin or a user. Admins can create quiz questions, while users can take quizzes and view their results.

Features

  • User Authentication: Separate login forms for users and admins.
  • Quiz Management: Admins can add quiz questions.
  • Dynamic Quiz Taking: Users can take quizzes and get immediate feedback.

Project Structure

  • appy.py: Flask application files.
  • env/: Virtual environment directory.
  • static/: Contains static files like CSS.
    • src/input.css: TailwindCSS entry point.
  • templates/: HTML templates for the application.
    • admin.html: Admin interface for managing quizzes.
    • index.html: Landing page with login forms.
    • quiz.html: Quiz taking interface for users.
    • result.html: Displays quiz results to users.
  • tailwind.config.js: TailwindCSS configuration.
  • connect.py: Credentials to establish connection with Database.
  • package.json: Node.js project file with dependencies.
  • requirements.txt: Python dependencies.
  • interview_questions_mcq.xlsx: Excel file containing quiz questions.

Setup

  1. Clone the repository
git clone https://github.com/ifsvivek/DBMS-Project
  1. Install dependencies

Ensure you have Node.js installed, then run:

npm install
  1. Generate TailwindCSS
npx tailwindcss -i ./static/src/input.css -o ./static/dist/css/output.css --watch
  1. Activate the virtual environment
python -m venv env  # Create a virtual environment
env\Scripts\activate  # On Windows
source env/bin/activate  # On Unix or MacOS
  1. Install Python dependencies
pip install -r requirements.txt
  1. Change the Database Credentials
host="localhost"
user="<Your_Username>" # root is default user
password="<Your_Password>"
database="<Your_Database_Name>"
  1. Run the Flask application
python appy.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

dbms-project's People

Contributors

ifsvivek avatar monishbl avatar

Watchers

 avatar

dbms-project's Issues

Implementing Password and proper log in method

Use bcrypt to hash the password before saving it to the database.

  • Function to Hash the Password and Save it to the user Table
import bcrypt
import mysql.connector

def hash_and_save_password(username, password, connection):
    # Hash the password
    salt = bcrypt.gensalt()
    hashed_password = bcrypt.hashpw(password.encode('utf-8'), salt)

    # Save the username and hashed password to the user table
    cursor = connection.cursor()
    sql_query = "INSERT INTO user (username, password) VALUES (%s, %s)"
    cursor.execute(sql_query, (username, hashed_password.decode('utf-8')))
    connection.commit()
    cursor.close()
  • Function to Verify the Password
def verify_password(username, entered_password, connection):
    # Retrieve the hashed password from the database
    cursor = connection.cursor()
    sql_query = "SELECT password FROM user WHERE username = %s"
    cursor.execute(sql_query, (username,))
    result = cursor.fetchone()
    cursor.close()

    if result is None:
        return False

    stored_hashed_password = result[0].encode('utf-8')

    # Verify the entered password against the stored hashed password
    return bcrypt.checkpw(entered_password.encode('utf-8'), stored_hashed_password)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.