0% found this document useful (0 votes)
31 views50 pages

cs project final edited

Uploaded by

akshob dhira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views50 pages

cs project final edited

Uploaded by

akshob dhira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 50

CONTENTS

S.N Titl Pg.


o e No.

1 PROJECT OVERVIEW

1.1 INTRODUCTION

1.2 OBJECTIVE

1.3 EXISTING SYSTEM

1.4 PROPOSED SYSTEM

2 OVERVIEW OF PYTHON AND


MYSQL

3 SYSTEM DEVELOPMENT LIFE


CYCLE

4 PHASE OF SYSTEM
DEVELOPMENT LIFE CYCLE

5 SYSTEM REQUIREMENTS

5.1 SOFTWARE REQUIREMENT

5.2 HARDWARE REQUIREMENT

6 MODULES
7 TESTING

8 CONCLUSION
1
9 SOURCE CODE

2
S.N Titl Pg.
o e No.

10 SCREEN SHOTS

11 BIBLIOGRAPHY

12 WEBLIOGRAPHY

3
1. PROJECT OVERVIEW:

INTRODUCTION:

This project is about student attendance management system and i chose this topic
because i have seen the struggles of my own school teachers spending their
valuable time on top of their already crowded responsibilities for manual entry of
the student’s attendance in other cases the attendance is not marked or the
attendance register is misplaced and it leads to a big chaos in the school
management system, i took this as a challenge to solve this problem by creating a
program. The program deals with the maintenance of the student’s attendance
details, it generates the attendance of the students on the basis of presence in class,
it is maintained on the daily basis of their attendance. The teachers are given a
unique username and password to make their students status,

The staffs handling the particular class will be responsible to make the
attendance for all students, only if the student is present on that particular day the
attendance will be calculated. The students attendance reprt will be generated

OBJECTIVE:
The objective is to create a program where there’s an admin assigned who can
enter the details of the teacher and provide an unique username and password for
a teacher, the teacher can log in and enter the attendance data, the students are also
provided an username and password, where they can log in and view or even
download their attendance report. The attendance data is securely stored in a
database.

EXISTING SYSTEM

In the existing system we use to manually enter the students name and their
attendance status in the attendance register notebook, it takes a lot of time to enter
the attendance and the main problem in this system is to store these registers in
cupboards or even in some worst cases the registers can be misplaced and lost this
leads to huge problem for the school management as well as the the respective
class teacher

4
PROPOSED SYSTEM

In the proposed system we will be using a database to store our attendance data
and an interactive program for easy entry of data. This will reduce the space for
storage of registers and the chances of registers getting lost is very low and further
problems like manual entry of data can be solved by using RFID [Radio
Frequency identification ] tags, where students can swipe these cards before
entering into their classroom to record their attendance in the database

2. OVERVIEW OF PYTHON AND MYSQL:

Overview of Python:
Python is a high-level, interpreted, interactive and object-oriented scripting
language. Python is designed to be highly readable. It uses English keywords
frequently where as other languages use punctuation, and it has fewer syntactical
constructions than other languages.
● Python is Interpreted
Python is processed at runtime by the interpreter. You do not

● Python is Interactive
You can actually sit at a Python prompt and interact with the interp

● Python is Object-Oriented
Python supports Object-Oriented style or technique of progra

● Python is a Beginner's Language


Python is a great language for the beginner-level p

History of Python

Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics and Computer
Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3,
C, C++, Algol-68, SmallTalk, and Unix shell and other scripting languages.

5
Python is copyrighted. Like Perl, Python source code is now available
under the GNU General Public License (GPL).
Python is now maintained by a core development team at the institute,
although Guido van Rossum still holds a vital role in directing its progress.

Python Features

Python's features include,


● Easy-to-learn
Python has few keywords, simple structure, and a clearly defined synta

● Easy-to-read
Python code is more clearly defined and visible to the eyes.

● Easy-to-maintain
Python's source code is fairly easy-to-maintain.

● A broad standard library


Python's bulk of the library is very portable and cross-pl

● Interactive Mode
Python has support for an interactive mode which allows interacti

● Portable
Python can run on a wide variety of hardware platforms and has the same in

● Extendable
You can add low-level modules to the Python interpreter. These modules

● Databases
Python provides interfaces to all major commercial databases.

● GUI Programming
Python supports GUI applications that can be created and ported

● Scalable
Python provides a better structure and support for large programs than shell

Apart from the above-mentioned features, Python has a big list of good
features, few are listed below:
6
● It supports functional and structured programming methods as well as
OOP.
● It can be used as a scripting language or can be compiled to byte-code
for building large applications.
● It provides very high-level dynamic data types and supports dynamic
type checking.
● It supports automatic garbage collection.
● It can be easily integrated with C, C++, COM, ActiveX, CORBA, and
Java.

7
Integrated Development Environment
To run Python from a Graphical User Interface (GUI) environment as,
● Unix IDLE is the very first Unix IDE for Python.
● Windows
PythonWin is the first Windows interface for Python and is an IDE with a G

● Macintosh
The Macintosh version of Python along with the IDLE IDE is available fr

Overview of MySQL:
Database Management System & Types of DBMS

A Database Management System (DBMS) is a software application that


interacts with the user, applications and the database itself to capture and
analyze data. The data stored in the database can be modified, retrieved and
deleted, and can be of any type like strings, numbers, images etc.

Types of DBMS
There are mainly 4 types of DBMS, which are Hierarchical, Relational,
Network, and Object-Oriented DBMS.

● Hierarchical DBMS: As the name suggests, this type of DBMS has a


style of predecessor-successor type of relationship. So, it has a structure
similar to that of a tree, wherein the nodes represent records and the
branches of the tree represent fields.
● Relational DBMS (RDBMS): This type of DBMS, uses a structure that
allows the users to identify and access data in relation to another piece of
data in the database.
● Network DBMS: This type of DBMS supports many to many relations
wherein multiple member records can be linked.
● Object-oriented DBMS: This type of DBMS uses
small individual software called objects. Each object contains a piece of
data, and the instructions for the actions to be done with the data.

8
Structured Query Language (SQL)

SQL is the core of a relational database which is used for accessing and
managing the database. By using SQL, you can add, update or delete rows of
data, retrieve subsets of information, modify databases and perform many
actions. The different subsets of SQL are as follows:

 DDL (Data Definition Language) – It allows you to perform various


operations on the database such as CREATE, ALTER and DELETE
objects.
 DML (Data Manipulation Language) – It allows you to access and
manipulate data. It helps you to insert, update, delete and retrieve data
from the database.
 DCL (Data Control Language) – It allows you to control access to the
database. Example – Grant or Revoke access permissions.
 TCL (Transaction Control Language) – It allows you to deal with the
transaction of the database. Example – Commit, Rollback, Savepoint, Set
Transaction.

What is MySQL & its Features

MySQL is an open-source relational database management system that works


on many platforms. It provides multi-user access to support many storage
engines and is backed by Oracle. So, you can buy a commercial license version
from Oracle to get premium support services.

The features of MySQL are as follows:

● Ease of Management – The software very easily gets downloaded and


also uses an event scheduler to schedule the tasks automatically.
● Robust Transactional Support – Holds the ACID (Atomicity,
Consistency, Isolation, Durability) property, and also allows distributed
multi-version support.
● Comprehensive Application Development – MySQL has plugin
libraries to embed the database into any application. It also supports
stored procedures, triggers, functions, views and many more for
application development.

9
● High Performance – Provides fast load utilities with distinct memory
caches and table index partitioning.

● Low Total Cost Of Ownership – This reduces licensing costs and


hardware expenditures.
● Open Source & 24 * 7 Support – This RDBMS can be used on any
platform and offers 24*7 support for open source and enterprise edition.
● Secure Data Protection – MySQL supports powerful mechanisms to
ensure that only authorized users have access to the databases
● High Availability – MySQL can run high-speed master/slave replication
configurations and it offers cluster servers.
● Scalability & Flexibility – With MySQL you can run deeply embedded
applications and create data warehouses holding a humongous amount of
data

3. SYSTEM DEVELOPMENT LIFE CYCLE

The systems development life cycle is a project management technique


10
that divides complex projects into smaller, more easily managed segments or
phases. Segmenting projects allows managers to verify the successful
completion of project phases before allocating resources to subsequent phases.

Software development projects typically include initiation, planning,


design, development, testing, implementation, and maintenance phases.
However, the phases may be divided differently depending on the organization
involved.

For example, initial project activities might be designated as request,


requirements-definition, and planning phases, or initiation, concept-
development, and planning phases. End users of the system under development
should be involved in reviewing the output of each phase to ensure the system is
being built to deliver the needed functionality.

4. PHASES OF SYSTEM DEVELOPMENT LIFE

CYCLE: INITIATION PHASE:

The Initiation Phase begins when a business sponsor identifies a need or an


opportunity.

The purpose of the Initiation Phase is to:

● Identify and validate an opportunity to improve business


accomplishments of the organization or a deficiency related to a business
need.
● Identify significant assumptions and constraints on solutions to that need.

11
● Recommend the exploration of alternative concepts and methods to
satisfy the need including questioning the need for technology, i.e., will a
change in the business process offer a solution?
● Assure executive business and executive technical sponsorship. The
Sponsor designates a Project Manager and the business need is
documented in a Concept Proposal. The Concept Proposal includes
information about the business process andthe relationship to the
Agency/Organization.

12
● Infrastructure and the Strategic Plan. A successful Concept Proposal
results in a Project Management Charter which outlines the authority of
the project manager to begin
the project.

Careful oversight is required to ensure projects support strategic business


objectives and resources are effectively implemented into an organization's
enterprise architecture. The initiation phase begins when an opportunity to add,
improve, or correct a system is identified and formally requested through the
presentation of a business case. The business case should, at a minimum,
describe a proposal’s purpose, identify expected benefits, and explain how the
proposed system supports one of the organization’s business strategies. The
business case should also identify alternative solutions and detail as many
informational, functional, and network requirements as possible.

SYSTEM CONCEPT DEVELOPMENT PHASE

The System Concept Development Phase begins after a business need or


opportunity is validated by the Agency/Organization Program Leadership and
the Agency/Organization CIO.

The purpose of the System Concept Development Phase is to:

● Determine the feasibility and appropriateness of the alternatives.


● Identify system interfaces.
● Identify basic functional and data requirements to satisfy the business
need.
● Establish system boundaries; identify goals, objectives, critical success
factors, and performance measure

13
SYSTEM CONCEPT DEVELOPMENT PHASE

The System Concept Development Phase begins after a business need or


opportunity is validated by the Agency/Organization Program Leadership and
the Agency/Organization CIO.
The purpose of the System Concept Development Phase is to:

● Determine the feasibility and appropriateness of the alternatives.


● Identify system interfaces.
● Identify basic functional and data requirements to satisfy the business
need.
● Establish system boundaries; identify goals, objectives, critical success
factors, and performance measures.
● Evaluate costs and benefits of alternative approaches to satisfy the basic
functional requirements
● Assess project risks
● Identify and initiate risk mitigation actions, andDevelop high-level
technical architecture, process models, data models, and a concept of
operations. This phase explores potential technical solutions within the
context of the business need.
● It may include several trade-off decisions such as the decision to use
COTS software products as opposed to developing custom software or
reusing software components, or the decision to use an incremental
delivery versus a complete, onetime deployment.
● Construction of executable prototypes is encouraged to evaluate
technology to support the business process. The System Boundary
Document serves as an important reference document to support the
Information Technology Project Request (ITPR) process.
14
● The ITPR must be approved by the State CIO before the project can move
forward.
PICTORIAL REPRESENTATION OF SDLC:

PLANNING PHASE:

The planning phase is the most critical step in completing development,


acquisition, and maintenance projects. Careful planning, particularly in the early
stages of a project, is necessary to coordinate activities and manage project risks
effectively. The depth and formality of project plans should be commensurate
with the characteristics and risks of a given project. Project plans refine the
information gathered during the initiation phase by further identifying the
specific activities and resources required to complete a project.
A critical part of a project manager’ sjob is to coordinate discussions
between user, audit, security, design, development, and network personnel to
identify and document as many functional, security, and network requirements
as possible. During this phase, a plan is developed that documents the approach
to be used and includes a discussion of methods, tools, tasks, resources, project
schedules, and user input. Personnel assignments, costs, project schedule, and

15
target dates are established.

A Project Management Plan is created with components related to


acquisition planning, configuration management planning, quality assurance
planning, concept of operations, system security, verification and validation, and
systems engineering management planning.

REQUIREMENTS ANALYSIS PHASE:

This phase formally defines the detailed functional user requirements


using high-level requirements identified in the Initiation, System Concept, and
Planning phases. It also delineates the requirements in terms of data, system
performance, security, and maintainability requirements for the system. The
requirements are defined in this phase to alevel of detail sufficient for systems
design to proceed. They need to be measurable, testable, and relate to the
business need or opportunity identified in the Initiation Phase. The requirements
that will be used to determine acceptance of the system are captured in the Test
and Evaluation MasterPlan.

The purposes of this phase are to:

● Further define and refine the functional and data requirements


and document them in the Requirements Document,
● Complete business process reengineering of the functions to be
supported (i.e., verify what information drives the business process, what
information is generated, who generates it, where does the information
go, and who processes it),

16
● Develop detailed data and process models (system inputs, outputs, and
the process.
● Develop the test and evaluation requirements that will be used
to determine acceptable system performance.

17
DESIGN PHASE:

The design phase involves converting the informational, functional, and


network requirements identified during the initiation and planning phases into
unified design specifications that developers use to scriptprograms during the
development phase. Program designs are constructed in various ways. Using a
top-down approach, designers first identify and link major program components
and interfaces, then expand design layouts as they identify and link smaller
subsystems and connections. Using a bottom-up approach, designers first
identify and link minor program components and interfaces, then expand design
layouts as they identify and link larger systems and connections. Contemporary
design techniques often use prototyping tools that build mock-up designs of
items such as application screens, database layouts, and system architectures.
End users, designers, developers, database managers, and network
administrators should review and refine the prototyped designs in an iterative
process until they agree on an acceptable design. Audit, security, and quality
assurance personnel should be involved in the review and approval process.
During this phase, the system is designed to satisfy the functional requirements
identified in the previous phase. Since problems in the design phase could be
very expensive to solve in the later stage of the software development, a variety
of elements are considered in the design to mitigate risk. These include:

● Identifying potential risks and defining mitigating design features.


● Performing a security risk assessment.
● Developing a conversion plan to migrate current data to the new system.
● Determining the operating environment.
● Defining major subsystems and their inputs and outputs.
● Allocating processes to resources.
● Preparing detailed logic specifications for each software module. The
result is a draft System Design Document which captures the preliminary
18
design for the system.

● Everything requiring user input or approval is documented and reviewed


by the user. Once these documents have been approved by the Agency
CIO and Business Sponsor, the final System Design Document is created
to serve as the Critical/Detailed Design for the system.
● This document receives a rigorous review byAgency technical and
functional representatives to ensure that it satisfies the business
requirements. Concurrent with the development of the system design, the
Agency Project Manager begins development of the Implementation Plan,
Operations and Maintenance Manual, and the Training Plan.

DEVELOPMENT PHASE:

The development phase involves converting design specifications into


executable programs. Effective development standards include requirements
that programmers and other project participants discuss design specification
before programming begins. The procedures help ensure programmers
clearly understand program designs and functional requirements.
Programmers use various techniques to develop computer programs. The
large transaction oriented programs associated with financial institutions
have traditionally been developed using procedural programming techniques.
Procedural programming involves the line-by-line scripting of logical
instructions that are combined to form a program.Effective completion of the
previous stages is a key factor in the success of the Development phase. The
Development phase consists of:

● Translating the detailed requirements and design into system components.


● Testing individual elements (units) for usability.
● Preparing for integration and testing of the IT system.
19
20
INTEGRATION AND TEST PHASE:

● Subsystem integration, system, security, and user acceptance testing is


conducted during the integration and test phase. The user, with those
responsible for quality assurance, validates that the functional
requirements, as defined in the functional requirements document, are
satisfied by the developed or modified system. OIT Security staff assess
the system security and issue a security certification and accreditation
prior to installation/implementation.

Multiple levels of testing are performed, including:

● Testing at the development facility by the contractor and


possibly supported by end users
● Testing as a deployed system with end users working together
with contract personnel

● Operational testing by the end user alone performing all functions.


Requirements are traced throughout testing,a final Independent
Verification & Validation evaluation is performed and all
documentation is reviewed and accepted prior to acceptance of the
system

IMPLEMENTATION PHASE:

This phase is initiated after the system has been tested and accepted by
the user. In this phase, the system is installed to support the intended business
functions. System performance is compared to performance objectives
established during the planning phase.

21
Implementation includes user notification, user training, installation of
hardware, installation of software onto production computers, and integration of
the system into daily work processes. This phase continues until the system is
operating in production in accordance with the defined user requirements.

OPERATIONS AND MAINTENANCE PHASE:

The system operation is ongoing. The system is monitored for continued


performance in accordance with user requirements and needed system
modifications are incorporated. Operations continue as long as the system can
be effectively adapted to respond to the organization’s needs. When
modifications or changes are identified, the system may reenter the planning
phase.
The purpose of this phase is to:

● Operate, maintain, and enhance the system.


● Certify that the system can process sensitive information.
● Conduct periodic assessments of the system to ensure the
functional requirements continue to be satisfied.
● Determine when the system needs to be modernized, replaced, or retired.

5. SYSTEM REQUIREMENTS

OPERATING SYSTEM
Windows 7 or higher
Mac OS X 10.11 or higher
Linux - ubuntu

22
6. SOFTWARE REQUIREMENT

PYTHON

Installation of python in windows

1. We can download python from their official python


website
2. Select the latest version
3. Select windows x86-64 executable installer or windows
x86 executable installer link
4. Run the python installer after downloading the python and
add the python version to path checkboxes
5. Select install now option

Installation of python in mac os

1. Enter the brew command into the terminal


2. --brew install python
3. setup the PATH environment variable
4. add the following line to the ~/. Profile file
5. export PATH=/usr/local/bin:/usr/local/sbin:$PATH
6. python installation directory looks like this you Should
add it to the PATH
7. PATH=”/library/framework/python.framework/version/
3.6/bin:${PATH}”

Installation of python in linux

1. You can download the latest version of python from the


official python website
23
2. extract the tar.xz file. It contains the source code od python
3. configure the script with $ cd python-3*
4. ./configure
5. verify the installation with typing “ python3 –version in the
terminal “

MYSQL

installation of MYSQL

1. download the MYSQL installer from the official website and


execute it
2. choose the appropriate setup type for your system and
choose developer default option for installing the whole
package
3. complete the installation process by completing the steps
.

.
7. HARDWARE REQUIREMENT

● Dual-core intel core i5 or similar


● graphics card
● x86-64 bit CPU
● 4 GB ram
● 128 Gb disk space

8. MODULES
1. mysql module

TESTING

24
Software Testing is an empirical investigation conducted to provide
stakeholders with information about the quality of the product or service under
test, with respect to the context in which it is intended to operate. Software
Testing also provides an objective, independent view of the software to allow
the business to appreciate and understand the risks at implementation of the
software. Test techniques include, but are not limited to, the process of
executing a program or application with the intent of finding software bugs.

It can also be stated as the process of validating and verifying that a software
program/application/product meets the business and technical requirements
that guided its design and development, so that it works expected and can be
implemented with the same characteristics. Software Testing, depending on
the testing method employed, can be implemented at any time in the
development process, however the most test effort is employed after the
requirements have been defined and coding process has been completed

TESTING METHODS
Software testing methods are traditionally divided into black box testing
and white box testing. These two approaches are used to describe the point of
view that a test engineer takes when designing test cases.

BLACK BOX TESTING


Black box testing treats the software as a "black box," without any
knowledge of internal implementation. Black box testing methods include:
equivalence partitioning, boundary value analysis, all-pairs testing, fuzz testing,
model-based testing, traceability matrix, exploratory testing and specification-
based testing.

SPECIFICATION-BASED TESTING

25
Specification-based testing aims to test the functionality of software
according to the applicable requirements.[16] Thus, the tester inputs data into,
and only sees the output from, the test object. This level of testing usually
requires thorough test cases to be provided to the tester, who then can simply
verify that for a given input, the output value (or behaviour), either "is" or "is
not" the same as the expected value specified in the test case. Specification-
based testing is necessary, but it is insufficient to guard against certain risks

ADVANTAGES AND DISADVANTAGES

The black box tester has no "bonds" with the code, and a tester's
perception is very simple: a code must have bugs. Using the principle, "Ask and
you shall receive," black box testers find bugs where programmers don't. But,
on the other hand, black box testing has been said to be "like a walk in a dark
labyrinth without a flashlight," because the tester doesn't know how the software
being tested was actually constructed.
That's why there are situations when (1) a black box tester writes many
test cases to check something that can be tested by only one test case, and/or (2)
some parts of the back end are not tested at all. Therefore, black box testing has
the advantage of "an unaffiliated opinion," on the one hand, and the
disadvantage of "blind exploring," on the other.

WHITE BOX TESTING

White box testing, by contrast to black box testing, is when the tester has
access to the internal data structures and algorithms (and the code that
implement these)
26
Types of white box testing:-
The following types of white box testing exist:
● api testing - Testing of the application using Public and Private
APIs.
● Code coverage - creating tests to satisfy some criteria of code
coverage.
For example, the test designer can create tests to cause all statements in
the program to be executed at least once.
● fault injection methods.

● mutation testing methods.


● static testing - White box testing includes all static testing.

CODE COMPLETENESS EVALUATION

White box testing methods can also be used to evaluate the completeness
of a test suite that was created with black box testing methods. This allows the
software team to examine parts of a system that are rarely tested and ensures
that the most important function points have been tested.
Two common forms of code coverage are:
● Function Coverage: Which reports on functions executed and
● Statement Coverage: Which reports on the number of lines
executed to complete the test.
They both return coverage metric, measured as a percentage

6. CONCLUSION:

27
7. SOURCE CODE:
#----------$ MYSQL CONNECTION $---------
import mysql.connector as connector

db = connector.connect(host="localhost",user="root",
passwd="",database="college", charset="utf8")
command_handler = db.cursor()

#----------$ TEACHER SESSION $----------

def teacher_session():
while 1:
print("")
print("----------------Teachers Menu------------")
print("1 - Mark student register")
print("2 - View student register")
print("3 - Logout")

user_option = input(str("option : "))


if user_option == "1":
print("")
print("##### Mark student register #####")
command_handler.execute("SELECT username FROM users WHERE
privilege = 'student' ")
records = command_handler.fetchall()
date = input(str("Date : DD/MM/YYYY : "))
for record in records:
record = str(record).replace("'","")
record = str(record).replace(",","")
record =str(record).replace("(","")
record = str(record).replace(")","")

# Present | absent | late

status = input(str("status for " + str(record) + "P/A/L :


"))
query_vals = (str(record),date,status)
command_handler.execute("INSERT INTO attendance (username,
date, status) VALUES (%s,%s,%s)", query_vals)
db.commit()
print(record + "Marked as " + status)
elif user_option == "2":
print("")
print("VIEWING ALL STUDENTS REGISTER")
print("-----------------------------")
command_handler.execute("SELECT username, date, status FROM
attendance")
records = command_handler.fetchall()
print("Displaying all registers")
print("------------------------------------")
28
for record in records:
print(record)

elif user_option == "3":


break
else:
print("NO VALID OPTION WAS SELECTED")

#--------$ STUDENT SESSION $---------

def student_session(username):
while 1:
print("")
print("-------------Students Menu-------------")
print("1 - View register")
print("2 - Download register")
print("3 - Logout")

user_option = input(str("Option : "))


if user_option == "1":
print("--------------------")
print("DISPLAYING REGISTER")
print("--------------------")
username = (str(username),)
command_handler.execute("SELECT date, username, status
FROM attendance WHERE username = %s", username)
records = command_handler.fetchall()
for record in records:
print(record)
elif user_option == "2":
print("--------------------")
print("DOWNLOADING REGISTER")
print("--------------------")
username = (str(username),)
command_handler.execute("SELECT date, username, status FROM
attendance WHERE username = %s", username)
records = command_handler.fetchall()
for record in records:
with open("register.txt", "w") as f:
f.write(str(record)+ "\n")
f.close()
print("All records saved")

# -------$ ADMIN SESSION $--------

def admin_session():
while 1:
print("")
print("----------------Admin Menu---------------")

29
print("1 - Register new Student")
print("2 - Register new Teacher")
print("3 - Delete Existing Student")
print("4 - Delete Existing Teacher")
print("5 - Logout")

user_option = input(str("Option : "))


if user_option == "1":
print("")
print("-------##--------Register New Student------
##------")
username = input(str("Student username : "))
password = input(str("Student password : "))
query_vals = (username,password)
command_handler.execute("INSERT INTO users
(username,password,privilege)VALUES (%s,
%s,'student')",query_vals)
db.commit()
print(username + " has been registered as a student")

elif user_option == "2":


print("")
print("---------##--------Register New Teacher---------
##---------")
username = input(str("Teacher username : "))
password = input(str("Teacher password : "))
query_vals = (username,password)
command_handler.execute("INSERT INTO users
(username,password,privilege) VALUES (%s,
%s,'teacher')",query_vals)
db.commit()
print(username + " has been registered as a teacher")

elif user_option == "3":


print("")
print("----------##---------Delete Existing Student
Account----------##--------")
username = input(str("Student username : "))
query_vals = (username,"student")
command_handler.execute("DELETE FROM users WHERE username =
%s AND privilege = %s ",query_vals)
db.commit()
if command_handler.rowcount < 1:
print("User not found")
else:
print(username + " has been deleted")

elif user_option == "4":


print("")
print("---------##--------Delete Existing Teacher

30
Account---------##--------")
username = input(str("Teacher username : "))
query_vals = (username,"teacher")

command_handler.execute("DELETE FROM users WHERE username =


%s AND privilege = %s ",query_vals)
db.commit()
if command_handler.rowcount < 1:
print("User not found")
else:
print(username + " has been deleted")

elif user_option == "5":


break
else:
print("No valid option selected")

#---------$ AUTHENTICATION -> STUDENT $-----------

def auth_student():
print("")
print("-----------------Student's Login------------")
print("")
username = input(str("Username : "))
password = input(str("Password : "))
query_vals = (username,password)
command_handler.execute("SELECT * FROM users WHERE username =
%s AND password = %s AND privilege = 'student'", query_vals)
if command_handler.rowcount <= 0:
print("Invalid login details")
else:
student_session(username)

#---------$ AUTHENTICATION -> TEACHER $-----------

def auth_teacher():
print("")
print("-----------------Teacher Login--------------")
print("")
username = input(str("Username : "))
password = input(str("Password : "))
query_vals = (username,password)
command_handler.execute("SELECT * FROM users WHERE username =
%s AND password = %s AND privilege = 'teacher'", query_vals)
if command_handler.rowcount <= 0:
print("Login not recognized")
else:
teacher_session()

31
#----------$ AUTHENTICATION -> ADMIN $------------

def auth_admin():
print("")
print("-----------------Admin Login----------------")
print("")
username = input(str("Username : "))
password = input(str("Password : "))
if username == "admin":
if password == "password":
admin_session()
else:
print("Incorrect password !")
else:
print("Login details not recognised")

#-----------$ MAIN PROGRAM $----------

def main():
while 1:
print("Welcome to the college system")
print("")
print("1. Login as student")
print("2. Login as teacher")
print("3. Login as admin")

user_option = input(str("Option : "))


if user_option == "1":
auth_student()
elif user_option == "2":
auth_teacher()
elif user_option == "3":
auth_admin()
else:
print("No valid option was selected")

main()

32
8. SCREEN SHOTS:

33
34
35
9. BIBLIOGRAPHY:

The python crash course by Eric Matthes

Python pocket reference by Mark Lutz

10. WEBLIOGRAPHY:

stackoverflow.com
w3schools.com
github.com

36
.

37
38
39
40
41
42
43
44
45
46
47
48
49
50

You might also like