diff --git a/consumerWebsite/Vivian/eco saver.mwb b/consumerWebsite/Vivian/eco saver.mwb
new file mode 100644
index 0000000..563e07f
Binary files /dev/null and b/consumerWebsite/Vivian/eco saver.mwb differ
diff --git a/consumerWebsite/Vivian/index.php b/consumerWebsite/Vivian/index.php
new file mode 100644
index 0000000..ba3725b
--- /dev/null
+++ b/consumerWebsite/Vivian/index.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+ Hello, world!
+
+
+ Hello, world!
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/consumerWebsite/Vivian/login.html b/consumerWebsite/Vivian/login.html
new file mode 100644
index 0000000..25f261c
--- /dev/null
+++ b/consumerWebsite/Vivian/login.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Login Page
+
+
+
+ Login
+
+
+
diff --git a/consumerWebsite/Vivian/login.js b/consumerWebsite/Vivian/login.js
new file mode 100644
index 0000000..a88887f
--- /dev/null
+++ b/consumerWebsite/Vivian/login.js
@@ -0,0 +1,37 @@
+function validateForm() {
+ var username = document.getElementById('email').value;
+ var password = document.getElementById('password').value;
+
+ // Perform basic validation
+ if (!email || !password) {
+ alert('Please enter both email and password');
+ return;
+ }
+
+ // If validation passes, send data to the server
+ sendDataToServer(email, password);
+}
+
+function sendDataToServer(email, password) {
+ // Use AJAX or fetch to send data to the server
+ // Example using fetch:
+ fetch('/login', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ email, password }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ // Handle the response from the server
+ console.log(data);
+ if (data.success) {
+ // Redirect or perform other actions for successful login
+ alert('Login successful');
+ } else {
+ alert('Login failed. Please check your credentials.');
+ }
+ })
+ .catch(error => console.error('Error:', error));
+}
diff --git a/consumerWebsite/Vivian/server.js b/consumerWebsite/Vivian/server.js
new file mode 100644
index 0000000..6d8edc6
--- /dev/null
+++ b/consumerWebsite/Vivian/server.js
@@ -0,0 +1,44 @@
+const express = require('express');
+const bodyParser = require('body-parser');
+const mysql = require('mysql');
+
+const app = express();
+const port = 3000;
+
+app.use(bodyParser.json());
+
+const db = mysql.createConnection({
+ host: 'localhost',
+ user: 'root',
+ password: 'your_mysql_password',
+ database: 'your_database_name',
+});
+
+db.connect(err => {
+ if (err) {
+ console.error('Error connecting to MySQL:', err);
+ } else {
+ console.log('Connected to MySQL');
+ }
+});
+
+app.post('/signup', (req, res) => {
+ const { username, password } = req.body;
+
+ // Perform server-side validation if needed
+
+ const sql = 'INSERT INTO users (username, password) VALUES (?, ?)';
+ db.query(sql, [username, password], (err, result) => {
+ if (err) {
+ console.error('Error executing SQL query:', err);
+ res.status(500).json({ success: false, message: 'Internal Server Error' });
+ } else {
+ console.log('User signed up successfully');
+ res.json({ success: true, message: 'User signed up successfully' });
+ }
+ });
+});
+
+app.listen(port, () => {
+ console.log(`Server is running on http://localhost:${port}`);
+});
diff --git a/consumerWebsite/Vivian/signup.html b/consumerWebsite/Vivian/signup.html
new file mode 100644
index 0000000..28a7d84
--- /dev/null
+++ b/consumerWebsite/Vivian/signup.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Signup Page
+
+
+
+ Signup
+
+
+
diff --git a/consumerWebsite/Vivian/signup.js b/consumerWebsite/Vivian/signup.js
new file mode 100644
index 0000000..2f036a4
--- /dev/null
+++ b/consumerWebsite/Vivian/signup.js
@@ -0,0 +1,35 @@
+function validateForm() {
+ var userid = document.getElementById('user_id').value;
+ var username = document.getElementById('user_name').value;
+ var email = document.getElementById('email').value;
+ var password = document.getElementById('password').value;
+ var confirmPassword = document.getElementById('confirmPassword').value;
+ var email = document.getElementById('email').value;
+
+ // Perform basic validation
+ if (password !== confirmPassword) {
+ alert('Passwords do not match');
+ return;
+ }
+
+ // If validation passes, send data to the server
+ sendDataToServer(username, email, password);
+}
+
+function sendDataToServer(username, password) {
+ // Use AJAX or fetch to send data to the server
+ // Example using fetch:
+ fetch('/signup', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ username, email, password }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ // Handle the response from the server
+ console.log(data);
+ })
+ .catch(error => console.error('Error:', error));
+}
diff --git a/webserver/functions/Database.js b/webserver/functions/Database.js
index 2c73813..d18f7dd 100644
--- a/webserver/functions/Database.js
+++ b/webserver/functions/Database.js
@@ -2,7 +2,7 @@ const { sequelize } = require("../Database/mySql.js");
const { api_log_Model } = require("../Database/model/apiLogModel.js");
const { sensorDataModel } = require("../Database/model/sensorDataModel.js");
const { apikeyModel } = require("../Database/model/apiKeyModel.js");
-const { compareAPIKey } = require("../functions/bcrypt.js");
+const { compareAPIKey } = require("./bcrypt.js");
async function insertLogData(log) {
try {
diff --git a/webserver/routes/apiLog.js b/webserver/routes/apiLog.js
new file mode 100644
index 0000000..80ed39a
--- /dev/null
+++ b/webserver/routes/apiLog.js
@@ -0,0 +1,77 @@
+const {
+
+} = require("../functions/apiDatabase.js");
+
+const express = require("express");
+const router = express.Router();
+
+
+
+module.exports = router;
+
+/*
+
+//get location
+router.get("/", async (req, res, next) => {
+ try {
+ const location = await getLocation();
+ //res send json and status code
+ res.status(200).json(location);
+ } catch (error) {
+ console.error(error);
+ next(error);
+ }
+});
+
+
+//add location
+router.post("/new", async (req, res, next) => {
+ try {
+ const { name, added_by, description } = req.body;
+ await addLocation(name, added_by, description);
+ res.sendStatus(200)
+ } catch (error) {
+ console.error(error);
+ next(error);
+ }
+});
+
+//update location
+router.put("/update", async (req, res, next) => {
+ try {
+ const { id, name, added_by, description } = req.body;
+ await updateLocation(id, name, added_by, description);
+ res.status(200).json({ message: "Location " + id + " updated" });
+ } catch (error) {
+ console.error(error);
+ next(error);
+ }
+});
+
+//delete location
+router.delete("/delete", async (req, res, next) => {
+ try {
+ const { id } = req.body;
+ await deleteLocation(id);
+ res.status(200).json({ message: "Location " + id + " deleted" });
+ } catch (error) {
+ console.error(error);
+ next(error);
+ }
+});
+
+
+
+//get location by id
+router.get("/:id", async (req, res, next) => {
+ try {
+ //get params
+ const { id } = req.params;
+ const location = await getLocationById(id);
+ res.status(200).json(location);
+ } catch (error) {
+ console.error(error);
+ next(error);
+ }
+});
+*/
\ No newline at end of file
diff --git a/webserver/routes/api_route.js b/webserver/routes/api_route.js
index a90c0df..1144957 100644
--- a/webserver/routes/api_route.js
+++ b/webserver/routes/api_route.js
@@ -26,6 +26,9 @@ router.use('/sensor', require('./sensor'))
//sensor data route
router.use('/sensor-data', require('./sensorData'));
+//log route
+//router.use('/log', require('./logLog'));
+