8 Dbms
8 Dbms
Practical No. 8
Aim: Design a Student registration form using HTML and connect it
with Firebase to add and retrieve data from firebase database.
Name of Student:
Roll No.:
Semester/Year:
Academic Session:
Date of Performance:
Date of Submission:
AIM: Design a Student registration form using HTML and connect it with Firebase to add and
retrieve data from firebase database.
THEORY:
What is Firebase?
Firebase is a Backend-as-a-Service (Baas). It provides developers with a variety of tools and
services to help them develop quality apps, grow their user base, and earn profit. It is built on
Google’s infrastructure.
Firebase is categorized as a NoSQL database program, which stores data in JSON-like documents.
In Firebase, a document is a set of key-value pairs defined by a schema. A group of documents makes up a
collection.
1. Authentication
It supports authentication using passwords, phone numbers, Google, Facebook, Twitter, and more.
The Firebase Authentication (SDK) can be used to manually integrate one or more sign-in
methods into an app.
2. Realtime database
Data is synced across all clients in realtime and remains available even when an app goes
offline.
3. Hosting
Firebase Hosting provides fast hosting for a web app; content is cached into content delivery
networks worldwide.
4. Test lab
The application is tested on virtual and physical devices located in Google’s data
centers.
5. Notifications
Notifications can be sent with firebase with no additional coding.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Registration Form</title>
</head>
<body>
<form action="" method="POST" id="registrationform">
<h1>Register</h1>
<div class="alert">Message Sent</div>
<fieldset>
<!-- Section 1 -->
<legend><span class="section">1</span>Your Basic Info</legend>
<fieldset>
<!-- section 2 -->
<legend><span class="section">2</span>Profile</legend>
<optgroup label="Web">
<option value="front_end_developer" id="frontend">Frontend Developer</option>
<option value="back_end_developer" id="backend">Backend Developer</option>
<option value="fullstack_developer" id="fullstack">Fullstack Developer</option>
</optgroup>
<optgroup label="Mobile">
<option value="android" id="android">Android</option>
<option value="ionic" id="ionic">Ionic</option>
<option value="phonegap" id="phonegap">PhoneGap</option>
</optgroup>
</select>
<br /><br />
<label>Interest:</label>
Let's see how we can do that using NodeJS and Firebase storage:-
CODE:
#<index.html>
<!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">
<title>Registeration Page | Firebase</title>
<script src="https://www.gstatic.com/firebasejs/8.4.2/firebase.js"></script>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<div class="container">
<div class="alert">Your message sent</div>
<div class="inputBox">
<input type="text" name="fullname" id="fullname" placeholder="Full Name" />
</div>
<div class="inputBox">
#<Styles.css>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container{
width: 90%;
height: 80vh;
padding: 20px;
border-radius: 20px;
box-shadow: 0px 5px 25px rgba(0,0,0,0.2);
display: flex;
justify-content: space-evenly;
align-items: center;
flex-direction: column;
}
.container form{
width: 100%;
height: 100%;
display: flex;
justify-content: space-evenly;
align-items: center;
flex-direction: column;
}
.inputBox{
width: 100%;
.inputBox textarea{
width: 100%;
height: 120px;
border-radius: 5px;
border: none;
outline: none;
overflow: hidden;
border: 1px solid rgba(0,0,0,0.2);
padding: 0px 10px;
font-size: 16px;
color: #444;
}
.inputBox button{
width: 100%;
padding: 10px 20px;
border: none;
outline: none;
background: rgb(0, 119, 255);
color: #FFF;
font-size: 20px;
font-weight: bold;
cursor: pointer;
}
.inputBox button:hover{
background: rgb(0, 17, 255);
transition: all 0.3s ease;
}
::placeholder{
font-size: 16px;
}
.alert{
Department of Computer Science and Engineering (CSE), S.B.J.I.T.M.R., Nagpur
Database Management System Lab (PCCCS405P)
width: 100%;
background: rgb(0, 255, 106);
padding: 10px 20px;
border-radius: 5px;
text-align: center;
font-size: 18px;
font-weight: 900;
display: none;
}
#<mail.js>
const firebaseConfig = {
apiKey: "AIzaSyDq9ia2DovYCY6TgDag6yapGGJuGKuCZd0",
authDomain: "dbms-project-43d5a.firebaseapp.com",
databaseURL: "https://dbms-project-43d5a-default-rtdb.firebaseio.com",
projectId: "dbms-project-43d5a",
storageBucket: "dbms-project-43d5a.appspot.com",
messagingSenderId: "239762829158",
appId: "1:239762829158:web:fe77ad7bea2e95e7e0a2a7",
measurementId: "G-Y7PHMHMFY9"
};
// initialize firebase
firebase.initializeApp(firebaseConfig);
// Declaring variables
var afullnamev, Rollnov, coursenamev, genderv, phonev, emailv, addressv;
SCREENSHOT:
CONCLUSION:
I have successfully understood how to design a student registration form using HTML and
connect it with Firebase to add and retrieve data from the Firebase database.
DISCUSSION QUESTIONS:
Q. 1) What is Firebase?
Q. 2) What are some of the advantages of Firebase?
Q. 3) What does FCM and GCM stand for?
Q. 4) What are the Firebase events?
Q. 5) What are the filtering methods in Firebase?
Q.6) What is the difference between Firebase and MongoDB?
REFERENCE:
∙ http://sage.virtual-labs.ac.in/home/pub/1/
∙ http://www.nptelvideos.in/2012/11/database-management-
system.html ∙ www.w3schools.com/sql
∙ SRM university DBMS Lab manual.
∙ OCA Oracle database 11G SQL Fundamentals1 Exam Guide by John watson.