Professional Documents
Culture Documents
Domain Main
Domain Main
CRYPTOCURRENCY
A PROJECT REPORT
Submitted by
P RAJENDRA 211801390016
T YADHUVAMSI 211801390029
P SUNANDITHA 211801390024
P SRILAKSMI 211801390036
V HARSHITH 211801390035
M ABHISHEK 211801390030
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
SIGNATURE SIGNATURE
SIDDHARTH KUMAR DR. P SUBRAT KUMAR
ASSISTANT PROFESSOR HOD, Associate Professor
Certified that the above-mentioned project has been duly carried out as per the norms of the college
and statutes of the university.
EXTERNAL SIGNATURE
ACKNOWLEDGEMENT
It is with at most pleasure and excitement we submit our project partial fulfilment of the
requirement for the award of Bachelor of Technology. The project is a result of the cumulative
efforts, support, guidance, encouragement and inspiration from many of those for whom we must
give our truthful honor and express gratitude through bringing out this project at the outset as
per our knowledge. We convey special thanks to our Project Guide, who has guided us and
encouraged us to enhance our knowledge with present working of this project to enrich the
quality of project. We expressed our appreciation to SIDDHARTH KUMAR, B.Tech, Teaching
Assistant, who facilitated us to providing a friendly environment which helped to enhance our
skills in the present project.
DECLERATION
We hereby declare that the project entitled "EOD PAYMENT SYSTEM USING
CRYPTOCURRENCY" submitted to the fulfilment of award the degree of B. TECH (CSE) at
CENTURION UNIVERSITY OF TECHNOLOGY AND MANAGEMENT (A.P). This project work
in original has not been submitted so far in any part or full for any other university or institute for the
award of any degree or diploma.
P RAJENDRA 211801390016
T YADHUVAMSI 211801390029
P SUNANDITHA 211801390024
P SRILAKSMI 211801390036
V HARSHITH 211801390035
M ABHISHEK 211801390030
ABSTRACT
The project "Exam on Demand Payment System Using Cryptocurrency" proposes a
novel approach to facilitate secure and efficient payment transactions for on-demand
examinations using cryptocurrency technology. Traditional payment systems often
face challenges such as high transaction fees, delays, and lack of transparency. By
leveraging cryptocurrency, this project aims to address these issues by implementing
a decentralized payment system that offers lower transaction costs, faster processing
times, and increased transparency. The system will allow users to seamlessly pay for
exam services, access study materials, and receive exam results in a secure and
decentralized manner. Through the integration of cryptocurrency technology, the
project seeks to revolutionize the payment landscape for on-demand examinations,
providing users with a more convenient and reliable payment solution.
Table of Contents
Title ............................................................................................................................... i
Certification ..................................................................................................................
ii
Acknowledgement .......................................................................................................
iii
Declaration ..................................................................................................................
iv
Abstract ......................................................................................................................... i
ii
3.1 Introduction ...................................................................................................... 13
3.2 System Analysis ............................................................................................... 13
3.2.1 Methods to be used to Gather the Functional and Non-Functional
Requirements ..................................................................................................... 13
3.2.2 Proposed Functional and Non-Functional Requirements ........................ 13
3.3 Prototyping Methodology ................................................................................ 14
3.3.1 Requirement gathering and analysis ........................................................ 14
3.3.2 Quick design ............................................................................................ 14
3.3.3 Build a prototype...................................................................................... 15
3.3.4 Initial user evaluation ............................................................................... 15
3.3.5 Refining prototype ................................................................................... 15
3.3.6 Implement product and maintenance ....................................................... 15
3.4 Justification of Methodology ........................................................................... 15
3.5 System Design.................................................................................................. 16
3.6 Tools and Techniques ....................................................................................... 16
3.7 Method to be used to test the proposed system ................................................ 17
3.8 Domain of Execution ....................................................................................... 17
3.9 Developed Modules and System Architecture ................................................. 18
3.10 Ethical Considerations ................................................................................... 18
Chapter 4: System Analysis and Design .................................................................... 19
iv
List of Figures
Figure 1: Conceptual Framework .............................................................................. 15
Figure 2: Prototyping Methodology (Despa, 2014) ................................................... 18
Figure 3: System Architecture ................................................................................... 24
Figure 4: Use Case ..................................................................................................... 25
Figure 5: Class Diagram............................................................................................. 28
Figure 6: General System Diagram ............................................................................ 29
Figure 7:Admin module ............................................................................................. 30
Figure 8: Mentee module ........................................................................................... 30
Figure 9: Mentor Module ........................................................................................... 31
Figure 10: ERD .......................................................................................................... 32
Figure 11;Database Schema ....................................................................................... 33
Figure 12: Cloning snippet ......................................................................................... 34
Figure 13: Clone Snippet ........................................................................................... 35
Figure 14: Xammp installation snippet ...................................................................... 36
Figure 15: Admin dashboard ...................................................................................... 37
Figure 16: Mentor Dashboard .................................................................................... 38
Figure 17:Mentee Dashboard ..................................................................................... 38
v
List of Abbreviations
6
Chapter 1: Introduction
1.1 Background
The modern educational landscape is witnessing a paradigm shift towards flexible
learning models, where students seek greater autonomy over their academic journey.
This evolution necessitates innovative approaches to assessment methods, prompting
the exploration of novel payment systems to accommodate the diverse needs of
learners. In response to this demand, the concept of an Exam on Demand Payment
System using cryptocurrency emerges as a groundbreaking solution.
This project aims to explore the feasibility and efficacy of implementing such a
system within educational institutions. Through a comprehensive analysis of existing
payment and assessment systems, including case studies of mentoring systems in
various universities, the project seeks to identify the shortcomings of current
frameworks and propose a technologically advanced solution.
7
The introduction of an Exam on Demand Payment System using cryptocurrency
holds the promise of revolutionizing the assessment landscape, empowering students
to take control of their learning journey while enhancing accessibility and inclusivity.
This project endeavors to contribute to the ongoing discourse on innovative
educational technologies and pave the way for a more efficient and learner-centric
assessment ecosystem.
1.3 Aim
The aim of the project "Exam on Demand Payment System Using Cryptocurrency"
is to develop a secure and efficient payment system that leverages cryptocurrency
technology to facilitate seamless transactions for accessing on-demand exams.
8
3. To develop a robust backend infrastructure that supports cryptocurrency
transactions securely.
4. To implement a user authentication and authorization mechanism for accessing
exams and making payments.
5. To ensure real-time transaction processing and confirmation using blockchain
technology.
1.5 Justification
The implementation of an Exam on Demand Payment System using cryptocurrency
can offer numerous benefits such as enhanced security, lower transaction costs,
global accessibility, faster settlement times, innovation, reduced fraud risk, and
educational opportunities, making it a compelling choice for modernizing exam fee
payment systems in educational institutions.
9
1.6.2 Limitations
10
their performance and provide feedback for continual improvement. Customer
support channels are readily available to address any queries or concerns. The
platform is designed for scalability and performance, capable of accommodating a
growing user base while maintaining efficiency and reliability.
11
Figure 1: Conceptual Framework
12
Chapter 3: Research Methodology
3.1 Introduction
Given the dynamic nature of both the cryptocurrency landscape and the education
sector, a robust methodology is essential to address the complexities inherent in
developing such a system. By leveraging established methodologies and adapting
them to the specific requirements of this project, we aim to deliver a reliable, secure,
and efficient payment system tailored for the educational domain.
13
Exam Scheduling: Facilitation of exam booking and scheduling by students.
Payment Processing: Integration of cryptocurrency transactions for exam fees.
Information Provision: Accessibility to information about the exam scheduling process
and cryptocurrency usage.
14
3.3.3 Build a prototype
A working prototype was constructed, reflecting user requirements and considering
development costs.
15
3.5 System Design
The developed system used the OOAD method where the following diagrams will be
drawn:
i. Use case diagram
Use case diagram is the graphic representation that is used to show the interactions
of different elements of the system like the user and different use cases in which the
user is involved. This will be used in the interaction between different elements in
the system.
ii. Class diagrams
Class diagram will be used to describe the attributes and operations of the class as well
as the constraints in the system. It will show the system’s class, attributes, relationships
and methods.
16
For development tools, we employed the PHP integrated development environment.
The system was built using the PHP programming language and the Laravel web
framework for robust back-end operations.
The front-end development utilized a combination of programming languages
including PHP, JavaScript, with HTML and CSS bringing the design elements to life,
ensuring a seamless and interactive user experience.
In the exam on demand payment system leveraging cryptocurrency, MetaMask
facilitates seamless payment transactions by allowing users to securely manage
Ethereum assets directly from their web browsers. EtherScan enhances transparency
by enabling users to verify payment transactions on the Ethereum blockchain, ensuring
accountability and trust in the payment process. Together, these tools streamline
cryptocurrency payments, enhancing user experience and providing real-time
transaction verification.
17
3.9 Developed Modules and System Architecture
The system's architecture supports seamless interaction between students and
examination facilitators. Through the web-based platform, students can select and
schedule exams, pay using cryptocurrency, and access exam-related materials.
Voluntary Participation: Ensuring users are participating of their own free will and can
opt out at any time.
Language Usage: Maintaining respectful communication within the system.
Anonymity: Guaranteeing user privacy and anonymity where required.
Acknowledgment: Properly citing and referencing third-party work.
Participant Safety: Ensuring the system does not cause physical or
psychological harm to users.
18
Chapter 4: System Analysis and Design
4.1 Introduction
The proposed project, "Exam on Demand Payment System Using Cryptocurrency,"
aims to leverage the advantages offered by cryptocurrencies to streamline and
enhance the process of paying for examinations on demand. Traditional payment
methods for exam fees often involve intermediaries, such as banks or payment
processors, which can introduce delays, incur transaction fees, and pose security
risks. By implementing a payment system based on cryptocurrencies, these
drawbacks can be mitigated, offering a more efficient, secure, and cost-effective
solution.
19
4.3 Systems Requirements
4.3.1 Functional Requirements
Requirement ID Requirement Description
FRQ3 The system should allow admins and mentors to post mentoring
materials
FRQ4 The system should allow the mentors and mentees to have a session
via a chat stream
FRQ5 The system should allow the admin the view reports.
20
NFRQ3 Usability The system should be easy to use and
navigate for end users.
21
4.5 System Designs
4.5.1 Use Case Diagram
22
Pre-Conditions Since the domain of execution is web-based
therefore the system must be connected to the
internet.
All Admin and Student should have access to
the system.
The admin should have access to the system.
The mentor should access the mentor’s
information.
Student
The mentors should be able to login to the
system.
The mentors should be able to start sessions
with mentees.
23
The mentors should be able to provide
mentoring materials to their mentees.
The mentors should be able to have access to
mentees background information.
Student
The mentees should be able to login to the
system.
The mentees should be able to access materials
on mentoring.
The mentees should be able to request for
meetings.
Alternate Courses For incorrect credentials, the system should be
able to validate the login and provide an error
message.
In case the users forget their password, they
should be able to reset it.
24
4.5.2 Class Diagram
25
4.5.3 Sequence Diagram
26
Figure 7:Admin module
27
4.5.4 Entity Related Diagram
28
4.5.5 Database Schema
29
Chapter 5: System Implementation and Testing
5.1 Introduction
In the implementation phase of the Exam on Demand Payment System utilizing
Cryptocurrency, the focus shifts from conceptualization and design to the actual
development and deployment of the system. This phase marks a crucial step in
realizing the project's objectives by translating theoretical concepts into a functional
and practical solution. Implementation involves the installation, configuration, and
integration of software components, as well as the development of supporting
documentation and manuals.
30
Figure 12: Cloning snippet
ii. You go to the terminal of your choice and clone the project to the directory of your
choice.
31
Figure 13: Clone Snippet iii. You then run the following commands one by one to
ensure the modules and libraries that keep it running are in place.
-Composer
update -npm
install.
-npm run dev.
-composer require larasocket-driver - npm i laravel-echo larasocket-js -npm run
dev -php artisan migrate:fresh -php artisan db:seed -php artisan key:generate
-Lastly you run php artisan serve to serve the project
and you can access the system with the URL provided
in the terminal.
iv. The command php artisan db:seed gives you dummy data to access the mentor
and admin
accounts, to get a mentee to register through the sign-up.
5.2.2.1 Pre-setup
i. Download XAMPP from the internet. Go to
https://www.apachefriends.org/index.html and select the installer for your
specific Operating system.
32
ii. Select the downloaded file and this will open the XAMPP setup window, you
many have to
click OK on a warning if you have a User Account Control activated on your computer.
iii. You leave the default options that have been selected and click next
iii. Use the default folder location to install the software and click next. v.
Once the Xampp setup wizard is completed click the Finish button.
33
5.2.2.2 Getting Started
i.After you have followed the steps stated in the installation procedure, you have to
access the URL printed in the terminal. Mostly the URL is http://127.0.0.1:8000,
though it may vary depending on the ports. ii.You then use the dummy data produced
by the php artisan db:seed command to access the admin dashboard. The email can
be found in the database while the default password is “password”, once you log in
successfully, you can have an overview of the systems and various functionality
available to the admin.
Figure 15: Admin login iii.To access the mentor’s dashboard you can use the data in
the database to access the email, and the password is “password” by default. Once you
successfully log in you can look at the list of mentees, check session requests, add a
blog and start a mentoring session.
34
Figure 16: Student login
iv.To sign in as a mentee you will need to fill in your details in the registration page and
from there you will log in the system to access the dashboard with the functionalities.
35
5.3 System Testing
The focus of this section is on what the system does and if it succeeds on the different
functionalities as stated in the functional and non-functional requirements. This
section will also detect system failures and classify each test according to priority.
36
T3 FRQ3 Does the The admin Email: mentor1@gmail High
system should
allow be able
admins to to add admins
add to the system.
mentors to
the system?
37
T6 FRQ6 Can the The mentee The mentor accepts the medium
mentor should first request and if he selects the
accept or send a reschedule button he is able
reschedule request to to give an alternative time
the request have a and date for the meeting in
and give session with the form of a text and send it
another the mentor to the mentee
time and
date to the
mentee?
38
T9 FRQ9 Does the Upon The mentee selected mentor2 Medium
system
registration
allow the
mentee to the mentee
select a should
mentor?
select
a
mentor
from the list
of mentors
provided
T10 FRQ10 Does the The mentee Meeting details: could we Medium
system allow
should be meet at 2 pm. I am feeling
the mentee to
request for a able to anxious.
session? request for a Meeting date: 2021-01-28
session
from the
mentor by
inputting the
meeting
details and
meeting date
39
T11 FRQ11 Does the The mentee Sending messages
system should
allow a chat request for a
session session and
between the mentor
mentor and to
mentee? accept the
request
40
T2 The system The system Pass The test was
should allow carried out
allowed the
mentors to view successfully and
the request and mentor to accept the results were
either accept or the request and as expected.
reschedule the
session also allowed the
mentor to
reschedule
giving the
mentee a day and
time when they
can have a
session.
41
Chapter 6: Conclusions, Recommendations and Future Works
6.1 Introduction
Earlier in Chapter Two, we addressed the conventional exam scheduling process,
which involved lengthy administrative procedures and fixed timetables, hindering
flexibility and immediate student needs. The "Exam on Demand" system we have
developed aims to mitigate these problems by integrating cryptocurrency as a means
of transaction and facilitating instant exam scheduling.
The system allows for seamless transactions using cryptocurrency, ensuring secure,
fast, and transparent handling of fees associated with exam scheduling. The
flexibility afforded by this system revolutionizes the way students can approach their
examinations, allowing for scheduling that aligns with their preparedness and
personal timetables, thus reducing stress and potentially improving performance.
6.2 Discussion
In chapter two we talked about the process of meeting your mentor by emailing them
and going to meet them in school hours at a designated location. This however had
some limitations that the system that has been developed has tried solving.
The system that has been developed allows users to request for sessions and have
live chat sessions with their mentors at their own comfort and at flexible times that
solves the issues related to time consumption, disruption of classes and
inconvenience. The developed system also provides blogs that educate mentees and
guide them throughout.
The developed system also has an admin module that adds mentors to the system.
The admin module is also able to monitor both mentors and mentees. The admin is
also able to generate reports.
42
6.3 Conclusion
Examinations are a critical component of the academic journey, and the ability to
schedule them as per one's convenience can greatly enhance the learning experience.
The "Exam on Demand" system, while novel in its approach by integrating
cryptocurrency, recognizes the unique challenges faced by students in today's fast-
paced academic environments. By offering a system that aligns with modern
technological advancements and financial trends, it empowers students to take control
of their assessment timelines. However, the requirement for a stable internet
connection and the system's current limitation to a single university are factors that
may restrict its accessibility and widespread adoption.
6.4 Recommendation and Future Work
Future enhancements for the "Exam on Demand" system will focus on broadening
reach through inter-university integration and developing offline functionalities to
reduce internet dependency. A mobile application is in the works to facilitate greater
access and convenience for users. The system will also integrate with university
academic modules for a seamless experience, ensuring scalability to support a growing
user base. Continuous investment in security will remain a priority to protect against
fraud and maintain transaction integrity, keeping the system at the forefront of
academic and technological advancements..
43
REFERENCES
[1] M. Abdelsalam, M. Shokry, and A. M. Idrees, “A Proposed Model for Improving the
Reliability of Online Exam Results Using Blockchain,” no. July 2023, pp. 7719–7733,
2024.
[2] P. Katsiampa, K. Moutsianas, and A. Urquhart, “Information demand and
cryptocurrency market activity,” Econ. Lett., vol. 185, p. 108714, Dec. 2019, doi:
10.1016/j.econlet.2019.108714.
[3] K. Grobys and J. Junttila, “Speculation and lottery-like demand in cryptocurrency
markets,” J. Int. Financ. Mark. Institutions Money, vol. 71, p. 101289, Mar. 2021, doi:
10.1016/j.intfin.2021.101289.
[4] H. Chey, “Cryptocurrencies and the IPE of money: an agenda for research,” Rev. Int.
Polit. Econ., vol. 30, no. 4, pp. 1605–1620, Jul. 2023, doi:
10.1080/09692290.2022.2109188.
[5] V. Manahov, “The rapid growth of cryptocurrencies: How profitable is trading in
digital money?,” Int. J. Financ. Econ., vol. 29, no. 2, pp. 2214–2229, Apr. 2024, doi:
10.1002/ijfe.2778.
[6] M. Abraham, “Studying the patterns and long-run dynamics in cryptocurrency
prices,” J. Corp. Account. Financ., vol. 31, no. 3, pp. 98–113, Jul. 2020, doi:
10.1002/jcaf.22427.
[7] K. Soska, J.-D. Dong, A. Khodaverdian, A. Zetlin-Jones, B. Routledge, and N. Christin,
“Towards Understanding Cryptocurrency Derivatives:A Case Study of BitMEX,” in
Proceedings of the Web Conference 2021, New York, NY, USA: ACM, Apr. 2021, pp.
45–57. doi: 10.1145/3442381.3450059.
[8] M. Gronwald, “How explosive are cryptocurrency prices?,” Financ. Res. Lett., vol. 38,
p. 101603, Jan. 2021, doi: 10.1016/j.frl.2020.101603.
[9] S. Demiralay and P. Golitsis, “On the dynamic equicorrelations in cryptocurrency
market,” Q. Rev. Econ. Financ., vol. 80, pp. 524–533, May 2021, doi:
10.1016/j.qref.2021.04.002.
[10] P. P. Baboshkin, A. Y. Mikhaylov, and Z. A. Shaikh, “Sustainable Cryptocurrency
Growth Impossible? Impact of Network Power Demand on Bitcoin Price,” Financ. J.,
vol. 14, no. 3, pp. 116–130, Jun. 2022, doi: 10.31107/2075-1990-2022-3-116-130.
[11] D. Zięba, R. Kokoszczyński, and K. Śledziewska, “Shock transmission in the
cryptocurrency market. Is Bitcoin the most influential?,” Int. Rev. Financ. Anal., vol.
44
64, pp. 102–125, Jul. 2019, doi: 10.1016/j.irfa.2019.04.009.
[12] A. Aspris, S. Foley, J. Svec, and L. Wang, “Decentralized exchanges: The ‘wild west’ of
cryptocurrency trading,” Int. Rev. Financ. Anal., vol. 77, p. 101845, Oct. 2021, doi:
10.1016/j.irfa.2021.101845.
[13] N. Jonker, “What drives the adoption of crypto-payments by online retailers?,”
Electron. Commer. Res. Appl., vol. 35, p. 100848, May 2019, doi:
10.1016/j.elerap.2019.100848.
45
APPENDIX: SOURCE CODE
LoginPage:html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Login</title>
<link rel="stylesheet" href="./css/login.css">
</head>
<body>
<h2>Student Login</h2>
<form action="login.php" method="post">
<label for="registration_number">Registration Number:</label>
<input type="text" id="registration_number" name="registration_number"
required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
AdminPage:Php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Details</title>
46
<link rel="stylesheet" href="./css/adminPage.css">
<link rel="stylesheet" href="./css/insert.css">
<style>
*{
margin: 0;
padding: 0;
}
header {
background-color: #b7b2b2;
color: #fff;
padding: 10px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.search-input {
padding: 5px;
border-radius: 5px;
border: 1px solid #fff;
margin-right: 10px;
}
47
border: none;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
.header-button.primary {
background-color: #007bff;
color: #fff;
margin-right: 5px;
}
.header-button.danger {
background-color: #dc3545;
color: #fff;
margin-right: 5px;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}
h2 {
text-align: center;
margin-top: 20px;
}
form {
text-align: center;
margin-top: 20px;
}
label {
48
font-weight: bold;
}
input[type="text"],
input[type="submit"] {
padding: 8px;
margin: 5px;
border-radius: 5px;
border: 1px solid #ccc;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.container {
max-width: 1000px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(220, 67, 67, 0.5);
margin-top: 20px;
}
table {
border-collapse: collapse;
width: 100%;
}
th,
td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
49
background-color: #f2f2f2;
}
.copy-text:hover{
cursor: pointer;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}
h2 {
text-align: center;
margin-top: 20px;
color: #333;
}
form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
input[type="text"],
input[type="submit"] {
width: calc(100% - 10px);
padding: 8px;
margin: 5px 0 10px;
border-radius: 5px;
border: 1px solid #ccc;
box-sizing: border-box;
font-size: 16px;
}
input[type="submit"] {
50
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #45a049;
}
p.error {
color: red;
margin-top: 10px;
}
p.success {
color: green;
margin-top: 10px;
}
</style>
</head>
<body>
<header>
<!-- Logo -->
<div class="logo">
<img src="./image/collegeLogo.png" alt="Logo">
</div>
51
<a href="https://sepolia.etherscan.io/" target="_blank"><button class="header-button
primary">Check Transaction</button></a>
</header>
<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Check if all form fields are set and not empty
if(isset($_POST['registration_number']) &&
!empty($_POST['registration_number']) &&
52
isset($_POST['name']) && !empty($_POST['name']) &&
isset($_POST['branch']) && !empty($_POST['branch']) &&
isset($_POST['course']) && !empty($_POST['course']) &&
isset($_POST['subject_name']) && !empty($_POST['subject_name']) &&
isset($_POST['subject_code']) && !empty($_POST['subject_code']) &&
isset($_POST['amount_rupees']) && !empty($_POST['amount_rupees']) &&
isset($_POST['amount_ethers']) && !empty($_POST['amount_ethers'])) {
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (mysqli_num_rows($check_student_result) > 0) {
// Student already exists, check if the name matches
$existing_student = mysqli_fetch_assoc($check_student_result);
if ($existing_student['Name'] !== $name) {
// Different name for existing registration number, show error
echo "<p>Error: A student with the same registration number already exists
but with a different name.</p>";
exit; // Stop further execution
}
// Get the Student_ID of the existing student
$student_id = $existing_student['Student_ID'];
} else {
// Student doesn't exist, insert new student
53
$insert_student_query = "INSERT INTO Students (Registration_Number,
Name,branch,course) VALUES ('$registration_number', '$name','$branch','$course')";
mysqli_query($conn, $insert_student_query);
// Get the Student_ID of the newly inserted student
$student_id = mysqli_insert_id($conn);
}
if (mysqli_num_rows($check_subject_result) > 0) {
// Subject already exists for this student, show error
echo "<p>Error: This subject already exists for this student.</p>";
exit; // Stop further execution
}
} else {
// Handle the case when form fields are not properly submitted
echo "Error: Form fields are not properly submitted.";
}
}
?>
<div id="insert_error_message" style="display:none;"></div>
</div>
54
if ($_SERVER["REQUEST_METHOD"] == "POST" &&
isset($_POST['search_registration_number'])) {
// Retrieve the registration number entered by the user
$registration_number = $_POST['search_registration_number'];
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (mysqli_num_rows($student_result) > 0) {
// Display student details
$student_row = mysqli_fetch_assoc($student_result);
echo "<p><strong>Registration Number:</strong> " .
htmlspecialchars($student_row['Registration_Number'] ?
$student_row['Registration_Number'] : "NULL") . "</p>";
echo "<p><strong>Name:</strong> " . htmlspecialchars($student_row['Name'] ?
$student_row['Name'] : "NULL") . "</p>";
echo "<p><strong>Course:</strong> " . htmlspecialchars($student_row['course'] ?
$student_row['course'] : "NULL") . "</p>";
echo "<p><strong>Branch:</strong> " . htmlspecialchars($student_row['branch']
? $student_row['branch'] : "NULL") . "</p>";
55
if (mysqli_num_rows($failed_subjects_result) > 0) {
// Display failed subjects in a table
// Display failed subjects in a table
echo "<h3>Failed Subjects:</h3>";
echo "<table>";
echo "<tr><th>Subject Name</th><th>Subject Code</th><th>Payment
Type</th><th>Transaction ID</th><th>Amount</th><th>Update</th></tr>";
while ($failed_subject_row = mysqli_fetch_assoc($failed_subjects_result)) {
echo "<tr>";
echo "<td>" . htmlspecialchars($failed_subject_row['Subject_Name'] ?
$failed_subject_row['Subject_Name'] : "NULL") . "</td>";
echo "<td>" . htmlspecialchars($failed_subject_row['Subject_Code'] ?
$failed_subject_row['Subject_Code'] : "NULL") . "</td>";
echo "<td>" . htmlspecialchars($failed_subject_row['Payment_Type'] ?
$failed_subject_row['Payment_Type'] : "NULL") . "</td>";
echo "<td><span class='copy-text'>" .
htmlspecialchars($failed_subject_row['Transaction_ID'] ?
$failed_subject_row['Transaction_ID'] : "NULL") . "</span></td>";
echo "<td>" . htmlspecialchars($failed_subject_row['amountEthers'] ?
$failed_subject_row['amountEthers'] : "NULL") . "</td>";
echo "<td><input type='checkbox' name='select_subject[]' class='cyberpunk-checkbox'
value='" . htmlspecialchars($failed_subject_row['Subject_Code']) . "'></td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<p>No failed subjects found.</p>";
}
} else {
echo "<p>No Student found with the Registration Number : " .
htmlspecialchars($registration_number) . "</p>";
}
56
document.getElementById("insert_form").addEventListener("submit", function(event)
{
var registrationNumber =
document.getElementById("insert_registration_number").value.trim();
var name = document.getElementById("insert_name").value.trim();
var branch = document.getElementById("insert_branch").value.trim();
var course = document.getElementById("insert_course").value.trim();
var subjectName = document.getElementById("insert_subject_name").value.trim();
var subjectCode = document.getElementById("insert_subject_code").value.trim();
var amountRupees =
document.getElementById("insert_amount_rupees").value.trim();
var amountEthers =
document.getElementById("insert_amount_ethers").value.trim();
</html>
EthersPyament:Php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Details</title>
<link rel="stylesheet" href="./css/ethersPayment.css">
57
<script
src="https://cdn.ethers.io/scripts/ethers-v3.min.js"
charset="utf-8"
type="text/javascript"
></script>
</head>
<body>
<div class="container">
<div class="card">
<?php
session_start(); // Start the session
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "students";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($result->num_rows > 0) {
// Output student details
while ($row = $result->fetch_assoc()) {
// Store student details in variables
$registrationNumber = $row['Registration_Number'];
$name = $row['Name'];
$branch = $row['branch'];
$course = $row['course'];
58
// Output student details
echo "<h2>Student Details</h2>";
echo "<p>Registration Number: " . $registrationNumber . "</p>";
echo "<p>Name: " . $name . "</p>";
echo "<p>Branch: " . $branch . "</p>";
echo "<p>Course: " . $course . "</p>";
}
} else {
echo "<p>No student details found.</p>";
}
$conn->close();
} else {
echo "<p>No registration number provided.</p>";
}
?>
</div>
<div class="card">
<h2>Selected Subjects</h2>
<table>
<thead>
<tr>
<th>Index</th>
<th>Subject Name</th>
<th>Subject Code</th>
<th>Ethers</th>
</tr>
</thead>
<tbody id="selectedRowsBody"></tbody>
</table>
</div>
</div>
<div class="card">
<h2>Pay with Crypto</h2>
<!-- Placeholder content for cryptocurrency payment -->
<div class="cryptoPaymentContent">
<h1>Transfer Funds via MetaMask</h1>
<div id="accountDetailsDiv">
<!-- Account details will be displayed here -->
</div>
<br />
<button id="connectButton">Connect Metamask</button>
<!-- Add id attribute to the Transfer Funds button -->
<div id="amount"></div>
59
<button id="transferButton">Transfer Funds</button>
</div>
</div>
<div id="transactionDetailsDiv" class="receipt" style="display: none;">
<!-- Transaction details will be displayed here -->
<h1>Receipt</h1>
<?php
// Check if student details are available
if (isset($registrationNumber) && isset($name) && isset($branch) && isset($course)) {
echo "<p><strong>Registration Number:</strong> $registrationNumber</p>";
echo "<p><strong>Name:</strong> $name</p>";
echo "<p><strong>Branch:</strong> $branch</p>";
echo "<p><strong>Course:</strong> $course</p>";
}
?>
<p><strong>Payment Type:</strong> Ethers</p>
<p><strong>Amount:</strong> <span id="paymentAmount"></span> Eth</p>
<p><strong>Transaction ID:</strong> <span id="transactionId"></span></p>
<p><strong>From Address:</strong> <span id="fromAddress"></span></p>
<p><strong>To Address:</strong> <span id="toAddress"></span></p>
<p><strong>Timestamp:</strong> <span id="timestamp"></span></p>
<h2>Selected Subjects</h2>
<table>
<thead>
<tr>
<th>Index</th>
<th>Subject Name</th>
<th>Subject Code</th>
<th>Ethers</th>
</tr>
</thead>
<tbody id="additionalTableBody"></tbody>
</table>
<!-- Add print button here -->
<button id="printButton">Print Receipt</button>
</div>
<script>
// Retrieve selected rows from session storage
document.getElementById("amount").innerText =sessionStorage.getItem('ethersSum');
var selectedRows = JSON.parse(sessionStorage.getItem("selectedRows"));
60
var index = 1;
if (selectedRows) {
selectedRows.forEach(function (row) {
var newRow = document.createElement("tr");
newRow.innerHTML = `
<td>${index}</td>
<td>${row.Subject_Name}</td>
<td>${row.Subject_Code}</td>
<td>${row.Ethers}</td>
`;
selectedRowsBody.appendChild(newRow);
index++;
});
}
61
const balance = await provider.getBalance(selectedAddress);
try {
const selectedAddress = ethereum.selectedAddress;
if (!selectedAddress) {
throw new Error(
"No account selected in MetaMask. Please select an account to proceed."
);
}
// Update the database with transaction details and selected rows data
62
});
// Display receipt
displayReceipt();
if (!response.ok) {
throw new Error('Failed to update database');
}
document.querySelector('.cryptoPaymentContent').style.display = 'none';
// Show print button
document.getElementById("printButton").style.display = "block";
function displayReceipt() {
// Retrieve payment details from session storage
63
var ethersSum = sessionStorage.getItem("ethersSum");
var transactionId = sessionStorage.getItem("transactionId");
var fromAddress = sessionStorage.getItem("fromAddress");
var toAddress = sessionStorage.getItem("toAddress");
var timestamp = sessionStorage.getItem("timestamp");
// Display receipt
document.getElementById("transactionDetailsDiv").style.display = "block";
64
});
await updateAccountDetails(accounts);
window.ethereum.on("accountsChanged", updateAccountDetails);
} catch (error) {
console.error("Error connecting to MetaMask:", error);
}
} else {
console.error("Metamask not detected.");
}
});
</script>
</body>
</html>
65