Waste Management System: Dbms Project 15CSE302

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

DBMS PROJECT

15CSE302

Waste Management System

Group details
1) Nikish Kumar S. V. (CB.EN.U4CSE17440)
2) Nithin Aakash (CB.EN.U4CSE17443)
3) Sahisnu S. (CB.EN.U4CSE17450)
4) Sanjay Tharagesh R. S. (CB.EN.U4CSE17453)
Frontend software details
The frontend of the project is developed as minimalistic, elegant and
interactive user interface. It is very simple to use for any kind of user.

The technology stack used for developing the front end application
are as follows
1) HTML
2) CSS
3) Bootstrap
4) JavaScript

Backend software details


The backend of the project is running on local machine and the
database is connected to AWS RDS services. Database is to
store/view/retrieve the details collected from each house.
The technology stack for developing backend application are
1) NodeJS
2) ExpressJS
3) MySQL
4) AWS RDS
Sample screenshots of the project

Frontend

1) Admin Login panel

2) User Login Panel


3) Admin dashboard

4) Admin’s control of Area details


5) Adding of New area from Admin dashboard

6) Response to confirm insertion of new area details.


7) Updating the existing area details through form

9) Delete area details


10) User registering the complaint through complaint/grievances
portal.

Backend
1) AWS RDS database running on Amazon cloud platform
2) Server code to handle user and admin requests
Sample Code
Importing necessary libraries
var express = require("express");
var bodyParser = require("body-parser");
var mysql = require("mysql");
var fs = require('fs');

Establishing SQL connection to AWS RDS


var connection = mysql.createConnection({
  host: "database-1.chlys9jqtfwf.us-east-1.rds.amazonaws.com", user: 
"nithin",
  password: "nithu1234",
  port: "3306",
  database: "innodb",
  connectTimeout: 30000,

});

Handling GET requests


app.get('/', function (req, res) {
  //res.sendFile('__dirname','first.html');
  res.sendFile('/home/nithu/myapp/dbms/index.html');
});

app.get('/user', function (req, res) {
  //res.sendFile('__dirname','first.html');
  res.sendFile('/home/nithu/myapp/dbms/index.html');
});

app.get('/admin', function (req, res) {
  //res.sendFile('__dirname','first.html');
  res.sendFile('/home/nithu/myapp/dbms/admin_login/index.html');
});

app.get('/register_user', function (req, res) {
  //res.sendFile('__dirname','first.html');
  res.sendFile('/home/nithu/myapp/dbms/user_reg.html');
});
Authentication
app.post('/ulogin', function (req, res) {
  let user_name = req.body.username;
  let user_password = req.body.password;
  console.log(user_name + " " + user_password);
  connection.query('SELECT u_password FROM client WHERE user_id="' + 
user_name + '";', function (err, result, fields) {
    if (err) throw err;
    console.log("data retrieved");
    let r = result[0].u_password;
    console.log(r);
    if (user_password != r)
      res.send('Authentication failed');
    else
    res.sendFile('/home/nithu/myapp/dbms/user_dash.html');
  });
});

app.post('/alogin', function (req, res) {
  let admin_name = req.body.adminname;
  let admin_password = req.body.password;

  console.log(admin_name + " " + admin_password);
  connection.query('SELECT a_password FROM admin WHERE admin_id="' + 
admin_name + '";', function (err, result, fields) {
    if (err) throw err;
    console.log("data retrieved");
    let r = result[0].a_password;
    console.log(r);
    if (admin_password != r)
      res.send('Authentication failed');
    else
    res.sendFile('/home/nithu/myapp/dbms/admin_dash.html');
  });
});
Updating database
app.post('/alogin/area_details/alogi2n', function (req, res) {
  let admin_name = req.body.id;
  let admin_password = req.body.field2;
  let ad1=req.body.field3;
  let ad2=req.body.field4;
 console.log("asdas");
  console.log(admin_name + " " + admin_password+ad1+ad2);
  
  var sql1 =
      "INSERT INTO area (area_id,name,latitude,longitude) VALUES ('" 
+
      req.body.id +
      "','" +
      req.body.field2 +
      "','" +
      req.body.field3+
      "','" +
      req.body.field4+
      "');";

  connection.query(sql1, function(err, result) {
        console.log(sql1);
        if (err) throw err;
        console.log("1 record inserted");
        res.send("area Added");
      });
});

app.post('/alogin/area_details/alogi3n', function (req, res) {
  let admin_name = req.body.field1;
  let admin_password = req.body.field2;
  let ad1=req.body.field3;
  let ad2=req.body.field4;
 console.log("asdas22");
  console.log(admin_name + " " + admin_password+"  "+ad1+"  "+ad2);
  
  var sql1 =
      "UPDATE area  set name='"+admin_password+"',latitude='"+ad1+"'
,longitude='"+ad2+"' where area_id='"+admin_name+"';"
     
  connection.query(sql1, function(err, result) {
        console.log(sql1);
        if (err) throw err;
        console.log("1 Area updated");
        res.send("area updated");
      });
});

app.post('/alogin/area_details/alogi4n', function (req, res) {
  let admin_name = req.body.field1;
  
  console.log("asdas22");
  console.log(admin_name );
  
  var sql1 =
      "Delete from area  where area_id='"+admin_name+"';"
     

connection.query(sql1, function(err, result) {
      console.log(sql1);
      if (err) throw err;
      console.log("1Area updated");
      res.send("area Deleted");
    });
});

Server hosting

var server = app.listen(3000, function () {
  console.log('Node server is running on port 3000');
});
Conclusion

The proposed idea for waste management is completely automated


system which enables users and waste management officials to
monitor the amount of waste generated from each household and
track the vehicles that transports the waste from each locality to
destination.
In future, Concept of green-points can be implemented that would
encourage the involvement of the residents or the end users making
the idea successful and helping to achieve joined efforts for the
waste management and hence fulfilling the idea of Swachh Bharath.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy