-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
67 lines (59 loc) · 2.43 KB
/
signup.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
<html>
<head>
<title>Firebase_form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="box">
<div class="form">
<h2>SAHAH</h2>
<form>
<div class="inputbox">
<input type="text" value="" id="username" required>
<span>Username</span>
</div>
<div class="inputbox">
<input type="email" value="" id="email" required>
<span>E-mail</span>
</div>
<div class="inputbox">
<input type="text" value="" id="phone" required>
<span>Phone Number</span>
</div>
<input type="submit" value="Register" class="sub" id="submit">
</form>
</div>
</div>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.1.0/firebase-app.js";
import { getDatabase,ref,set,get,child } from "https://www.gstatic.com/firebasejs/10.1.0/firebase-database.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyA4OOfPmoM0_qpKG7zaNhMmRGg-NNrLZjc",
authDomain: "sahah-b52ec.firebaseapp.com",
databaseURL: "https://sahah-b52ec-default-rtdb.firebaseio.com/",
projectId: "sahah-b52ec",
storageBucket: "sahah-b52ec.appspot.com",
messagingSenderId: "213546548711",
appId: "1:213546548711:web:9b5661349cc635fe6c1142"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getDatabase (app);
document.getElementById("submit").addEventListener("click", function(e) {
e.preventDefault();
set (ref(db, 'user/' + document.getElementById("username").value),
{
username: document.getElementById("username").value,
email: document.getElementById("email").value,
PhoneNumber: document.getElementById("phone").value
});
alert("Register Successful!");
window.location.href = "index.html";
})
</script>
</body>
</html>