-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab5.html
140 lines (134 loc) · 5.5 KB
/
Lab5.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSC 225 Lab 5</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<marquee direction="right"><h1 class="display-4">OFFER EXPIRES IN TEN MINUTES!!!</h1></marquee>
<h1 class="display-4"><i><u><b>PLEASE FILL OUT THE FOLLOWING FORM TO COMPLETE YOUR REGISTRATION.</b></u></i></h1>
</div>
</div>
<br/>
<div class="row justify-content-center">
<div class="col-sm-4">
<form>
<div class="form-group">
<label for="fname">First Name:</label>
<input type="text" class="form-control" id="fname">
</div>
</form>
</div>
<div class="col-sm-4">
<form>
<div class="form-group">
<label for="lname">Last Name:</label>
<input type="text" class="form-control" id="lname">
</div>
</form>
</div>
</div>
<br/>
<div class="row justify-content-center">
<div class="col-sm-4">
<form>
<div class="form-group">
<label for="emailaddr">Email Address:</label>
<input type="email" class="form-control" id="emailaddr">
<small id="Extra_Note"><i>PlEASE NOTE: We <b> WILL</b> sell your email and private information to third parties. Deal with it!</i></small>
</div>
</form>
</div>
<div class="col-sm-4">
<form>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password">
<small id="Extra_Note_2"><i>Passwords must be at least eight characters in length and contain one special character.</i></small>
</div>
</form>
</div>
</div>
<div class="row justify-content-center">
<div class="col-sm-8">
<form>
<div class="form-group">
<label for="dob">Date of Birth:</label>
<input type="date" class="form-control" id="dob">
</div>
</form>
</div>
</div>
<br/>
<div class="row justify-content-center">
<div class="col-sm-2 d-flex align-items-center">
<label for="captcha" id="Captcha" class="me-2"></label>
<input type="text" class="form-control form-control-sm" id="answer" style="width: 60px;"> <br/>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-8">
<button type="button" id="SubmitReg" onclick="ValidateRegistrationInformation()">SUBMIT REGISTRATION</button>
</div>
</div>
<br/>
<div class="row justify-content-center">
<div class="col-md-8">
<label for="DomTxt" id="DomTxt"></label>
</div>
</div>
<br/>
<br/>
<div class="container">
<div class="row">
<div class="col-sm-4">
<img src="CSC225Cheating.png" class="rounded"/>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
var num1 = Math.floor(Math.random() * 9) + 1;
var num2 = Math.floor(Math.random() * 9) + 1;
var correct_answer = num1+num2;
document.getElementById("Captcha").innerHTML = "What is " + num1 + " + " + num2 + " ?";
function ValidateRegistrationInformation() {
const user = {
firstName: document.getElementById("fname").value,
lastName: document.getElementById("lname").value,
dob: document.getElementById("dob").value,
email: document.getElementById("emailaddr").value,
password: document.getElementById("password").value,
cap_answer: document.getElementById("answer").value
};
for (let key in user)
{
if (user[key].trim() === "")
{
alert(`Please fill in the ${key} field.`);
return;
}
}
if ((user.password.length < 8) || !(user.password.includes("!") || user.password.includes("?")))
{
alert("Passwords must be 8 or greater characters and contain a special character");
return;
}
if (parseInt(user.cap_answer,10) != correct_answer)
{
alert("YOU HAVE ENTERED THE WRONG CAPTCHA. HOW THAT'S EVEN POSSIBLE I DO NOT KNOW. DID YOU PASS THE FIRST GRADE, IDIOT?");
return;
}
let s_char = "*";
let temp_pw = s_char.repeat(user.password.length-1);
document.getElementById("DomTxt").innerHTML = "<i>Thank you for joining CSC225Cheat.com!</i><br/> Your Registration Information:</br>" + "Name: " + user.firstName + " " + user.lastName + "<br/> DOB: " + user.dob + "<br/>Email: " + user.email + "<br/>Password: <b>" + user.password[0] + "</b>" + temp_pw;
}
</script>