0% found this document useful (0 votes)
22 views5 pages

Extended UPSC Registration Project

The document outlines the UPSC Registration Information System, a Python-based application that connects to a MySQL database for managing candidate registrations. It includes functionalities for candidate registration, login, exam applications, document uploads, payment processing, profile viewing, and an admin panel for managing applications and payments. The system is designed to streamline the registration process for UPSC exams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views5 pages

Extended UPSC Registration Project

The document outlines the UPSC Registration Information System, a Python-based application that connects to a MySQL database for managing candidate registrations. It includes functionalities for candidate registration, login, exam applications, document uploads, payment processing, profile viewing, and an admin panel for managing applications and payments. The system is designed to streamline the registration process for UPSC exams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Extended UPSC Registration Information System Project

# -------- UPSC REGISTRATION INFORMATION SYSTEM --------


# Developed in Python with MySQL connectivity

import mysql.connector
import time
from datetime import datetime

def slow_print(text):
for char in text:
print(char, end='', flush=True)
time.sleep(0.01)
print()

# Connect to MySQL Database


conn = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database="upsc_system"
)
cursor = conn.cursor()

# ---------------- Helper Functions ----------------


def print_header(title):
print("\n" + "=" * 50)
slow_print(f"{title.center(50)}")
print("=" * 50)

def line():
print("-" * 50)

# ---------------- Candidate Registration ----------------


def register_candidate():
print_header("Candidate Registration")
full_name = input("Full Name: ")
father_name = input("Father's Name: ")
mother_name = input("Mother's Name: ")
dob = input("DOB (YYYY-MM-DD): ")
gender = input("Gender: ")
nationality = input("Nationality: ")
category = input("Category: ")
disability_status = input("PwBD (Yes/No): ")
email = input("Email: ")
phone = input("Phone: ")
aadhaar_no = input("Aadhaar No: ")
address = input("Address: ")
state = input("State: ")
exam_center = input("Preferred Center: ")
qualification = input("Qualification: ")
user_id = input("Create User ID: ")
password = input("Create Password: ")

try:
cursor.execute("""
INSERT INTO candidates (full_name, father_name, mother_name, dob, gender,
nationality, category, disability_status, email, phone, aadhaar_no, address,
state, exam_center, qualification)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
""", (
full_name, father_name, mother_name, dob, gender, nationality, category,
disability_status, email, phone, aadhaar_no, address, state, exam_center,
qualification
))
conn.commit()
candidate_id = cursor.lastrowid
cursor.execute("INSERT INTO login (user_id, password, candidate_id) VALUES (%s, %s, %s)",
(user_id, password, candidate_id))
conn.commit()
print("Registration Complete. Your ID:", candidate_id)
except Exception as e:
print("Error:", e)
conn.rollback()

# ---------------- Login ----------------


def login():
print_header("Candidate Login")
user = input("User ID: ")
pwd = input("Password: ")
cursor.execute("SELECT candidate_id FROM login WHERE user_id=%s AND password=%s", (user, pwd))
result = cursor.fetchone()
if result:
print("Login Successful.")
return result[0]
else:
print("Invalid Credentials.")
return None

# ---------------- Apply for Exam ----------------


def apply_exam(candidate_id):
print_header("Available Examinations")
cursor.execute("SELECT * FROM examinations")
exams = cursor.fetchall()
for e in exams:
print(f"{e[0]}. {e[1]} - {e[2]} on {e[3]}")
exam_id = input("Enter Exam ID to apply: ")
try:
cursor.execute("INSERT INTO applications (candidate_id, exam_id) VALUES (%s, %s)",
(candidate_id, exam_id))
conn.commit()
print("Exam application submitted.")
except:
print("Already applied or invalid exam.")
conn.rollback()
# ---------------- Upload Documents ----------------
def upload_documents(candidate_id):
print_header("Upload Documents")
for doc in ['Photo', 'Signature', 'Aadhaar', 'Marksheet']:
path = input(f"Path for {doc}: ")
cursor.execute("INSERT INTO documents (candidate_id, document_type, file_path) VALUES (%s,
%s, %s)",
(candidate_id, doc, path))
conn.commit()
print("Documents uploaded.")

# ---------------- Make Payment ----------------


def make_payment(candidate_id):
print_header("Payment Portal")
amount = float(input("Amount: "))
method = input("Method (UPI/Card/NetBanking): ")
status = "Success"
cursor.execute("INSERT INTO payments (candidate_id, amount, method, status) VALUES (%s, %s,
%s, %s)",
(candidate_id, amount, method, status))
conn.commit()
print("Payment successful.")

# ---------------- View Profile ----------------


def view_profile(candidate_id):
print_header("Candidate Profile")
cursor.execute("SELECT * FROM candidates WHERE id=%s", (candidate_id,))
data = cursor.fetchone()
if data:
labels = ["ID", "Name", "Father", "Mother", "DOB", "Gender", "Nationality", "Category",
"Disability", "Email", "Phone", "Aadhaar", "Address", "State", "Center",
"Qualification"]
for lbl, val in zip(labels, data):
print(f"{lbl}: {val}")

# ---------------- Change Password ----------------


def change_password(candidate_id):
print_header("Change Password")
new_pass = input("Enter New Password: ")
cursor.execute("UPDATE login SET password=%s WHERE candidate_id=%s", (new_pass, candidate_id))
conn.commit()
print("Password updated.")

# ---------------- Admin Panel ----------------


def admin_panel():
print_header("Admin Panel")
u = input("Admin Username: ")
p = input("Admin Password: ")
cursor.execute("SELECT * FROM admin WHERE username=%s AND password=%s", (u, p))
if not cursor.fetchone():
print("Invalid admin.")
return
while True:
print("\n1. View Applications\n2. View Payments\n3. Update Application Status\n4. Exit")
ch = input("Choice: ")
if ch == '1':
cursor.execute("SELECT * FROM applications")
for row in cursor.fetchall():
print(row)
elif ch == '2':
cursor.execute("SELECT * FROM payments")
for row in cursor.fetchall():
print(row)
elif ch == '3':
aid = input("Application ID: ")
stat = input("New Status: ")
cursor.execute("UPDATE applications SET status=%s WHERE app_id=%s", (stat, aid))
conn.commit()
elif ch == '4':
break

# ---------------- Main ----------------


def main():
while True:
print_header("UPSC Registration System")
print("1. Register\n2. Login\n3. Admin\n4. Exit")
op = input("Choose option: ")
if op == '1':
register_candidate()
elif op == '2':
cid = login()
if cid:
while True:
print("\n1. Apply Exam\n2. Upload Documents\n3. Make Payment\n4. View
Profile\n5. Change Password\n6. Logout")
ch = input("Select: ")
if ch == '1':
apply_exam(cid)
elif ch == '2':
upload_documents(cid)
elif ch == '3':
make_payment(cid)
elif ch == '4':
view_profile(cid)
elif ch == '5':
change_password(cid)
elif ch == '6':
break
elif op == '3':
admin_panel()
elif op == '4':
break

main()
cursor.close()
conn.close()

You might also like