-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
109 lines (96 loc) · 5.23 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<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>Document</title>
</head>
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script>
// Your web app's Firebase configuration
//----------------------------------------------------------------------------------
//EDIT FIREBASE CONFIG HERE
const firebaseConfig = {
apiKey: "AIzaSyCu-8GJVqeH4YbRZpMttq2_5RkMVeoEeeU",
authDomain: "ecertiverification.firebaseapp.com",
databaseURL: "https://ecertiverification-default-rtdb.firebaseio.com",
projectId: "ecertiverification",
storageBucket: "ecertiverification.appspot.com",
messagingSenderId: "922593065137",
appId: "1:922593065137:web:45da860533a6f6ab710a90"
};
//EDIT FIREBASE CONFIG HERE
//----------------------------------------------------------------------------------
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
var db = firebase.database().ref()
//db.on("value", (snapshot) =
</script>
<div class="container border border-5" style="padding: 10px;">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">Enter Certificate ID</span>
<input id="inputbyuser" type="text" class="form-control" placeholder="Example: SAMPLECERT01" aria-label="Username"
aria-describedby="basic-addon1">
</div>
<div align="center">
<button id="verifbutton" type="button" class="btn btn-success">Verify Certificate</button>
</div><br>
<div align="center" class="border border-5" id="innerborder" style="display: none; padding: 2em">
<h3 id="output_message">
</h3>
<button style="display: none;" id="downloadbtn" type="button" class="btn btn-primary">Download
Certificate</button>
</div>
</div>
<script>
var verificationbutton = document.getElementById("verifbutton");
var downbtn = document.getElementById("downloadbtn");
var downcertlink = ""
downbtn.addEventListener("click", () => {
window.open(downcertlink)
})
verificationbutton.addEventListener("click", () => {
downbtn.style.display = "none"
document.getElementById("innerborder").style.display = "block";
var textinput = document.getElementById("inputbyuser");
var textinputvalue = document.getElementById("inputbyuser").value;
//var textsubset = textinput.substring(0, 6)
//console.log(textsubset)
// --------------------------------------------------------------------------------
//EDIT LENGTH, SUBSTRING INDEX AND SUBSTRING VALUES IN THE NEXT LINE
if (textinputvalue.length == 12 && textinputvalue.substring(0, 10) == "SAMPLECERT") {
//EDIT LENGTH, SUBSTRING INDEX AND SUBSTRING VALUES IN THE NEXT LINE
//---------------------------------------------------------------------------------
db.on("value", (snapshot) => {
downcertlink = snapshot.child(textinputvalue).child("Link").val();
if (downcertlink != null) {
var verification_text = document.getElementById("output_message");
verification_text.innerHTML = "Your Certificate ID is verified!<br> Click on the Download button to download your Certificate.";
//textinput.appendChild("h3")
downbtn.style.display = "inline";
}
else {
var verification_text = document.getElementById("output_message");
verification_text.innerHTML = "Certificate Not Found!<br> Verify your Certificate ID again.<br> If issue persists, contact the WebAdmin or UHC";
}
//window.open(certlink)
})
}
else {
var verification_text = document.getElementById("output_message");
verification_text.innerHTML = "Wrong Certification ID, please recheck if the ID is valid or not.";
}
})
</script>
<b>Use SAMPLECERT01, SAMPLECERT02, SAMPLECERT03 to view the sample certificates.</b>
<b><u><a href="https://github.com/AshwinHebbar314/Sample-e-CertificateVerification">Click here to find the repository behind this web application</a></b></u>
</body>
</html>