Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add_MySQL_Connection_Pool_with_Environment_Variable_Support #172

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions config/mysql_connection.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const mysql=require('mysql')
const mysql = require('mysql');
require('dotenv').config();

require("dotenv").config()
const DB_HOST = process.env.DB_HOST
const DB_USER = process.env.DB_USER
const DB_PASSWORD = process.env.DB_PASSWORD
const DB_DATABASE = process.env.DB_DATABASE
const DB_PORT = process.env.DB_PORT
const DB_HOST = process.env.DB_HOST;
const DB_USER = process.env.DB_USER;
const DB_PASSWORD = process.env.DB_PASSWORD;
const DB_DATABASE = process.env.DB_DATABASE;
const DB_PORT = process.env.DB_PORT;

const db = mysql.createPool({
connectionLimit: 100,
Expand All @@ -14,6 +14,25 @@ const db = mysql.createPool({
password: DB_PASSWORD,
database: DB_DATABASE,
port: DB_PORT
})
});

module.exports = db
// Check connection
db.getConnection((err, connection) => {
if (err) {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
console.error('Database connection was closed.');
}
if (err.code === 'ER_CON_COUNT_ERROR') {
console.error('Database has too many connections.');
}
if (err.code === 'ECONNREFUSED') {
console.error('Database connection was refused.');
}
}

if (connection) connection.release();

return;
});

module.exports = db;
3 changes: 2 additions & 1 deletion public/choose-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">

<div class="container">
<h2>Select Who You Are</h2>
<div class="radio">
Expand Down
4 changes: 2 additions & 2 deletions public/contact-us.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
<div class="maindiv">
<div class="imgdiv">
<img src="./images/logo.png" alt="" style="border-radius: 6px;">
<img src="./images/logo.webp" alt="" style="border-radius: 6px;">
</div>
<div class="formdiv">
<form action="" class="form">
Expand Down
4 changes: 2 additions & 2 deletions public/fac_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
<div class="container">
<div class="image">
<img src="images/logo.png" alt="">
<img src="images/logo.webp" alt="">
</div>
<div id="box2">
<p>Sorry! User not found</p>
Expand Down
10 changes: 5 additions & 5 deletions public/faculty.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<p id="result2"><i class="fa-solid fa-xmark" style="padding: 0px 12px;font-size: 26px;"></i>An error occured</p>
<header>
<div class="head">
<div class="logo"><img src="images/logo.png" alt="" width="160px"></div>
<div class="logo"><img src="images/logo.webp" alt="" width="160px"></div>
<div id="heading" style="font-size: 34px;color: white;">Research Nexas</div>
<div>
<a href="" title="View Profile"><i class="fa-solid fa-user"
style="font-size: 30px;padding: 12px 13px;border:3px solid white;border-radius:50%;color:white"></i></a>
</div>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
</div>
<nav>
</header>
Expand All @@ -34,7 +34,7 @@
</div>
<div class="containers">
<div class="boxes" id="box1">
<img src="images/badges.png" alt="">
<img src="images/badges.webp" alt="">
<h4>Evaluation Criteria</h4>
<p style="color: white;">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Fugit repellendus
dolorum quas delectus,
Expand All @@ -44,7 +44,7 @@ <h4>Evaluation Criteria</h4>
Culpa voluptatum enim assumenda nostrum!</p>
</div>
<div class="boxes" id="box2">
<img src="images/badges.png" alt="">
<img src="images/badges.webp" alt="">
<h4>Evaluated Papers</h4>
<p style="color: white;">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Fugit repellendus
dolorum quas delectus,
Expand All @@ -54,7 +54,7 @@ <h4>Evaluated Papers</h4>
Culpa voluptatum enim assumenda nostrum!</p>
</div>
<div class="boxes" id="box3">
<img src="images/badges.png" alt="">
<img src="images/badges.webp" alt="">
<h4>Your Profile</h4>
<p style="color: white;">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Fugit repellendus
dolorum quas delectus,
Expand Down
46 changes: 38 additions & 8 deletions public/form_filling.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<div class="form-group">
<label>Email</label>
<input type="email" name="email" id="email">
<p id="emailError" style="font-size: 18px; color: red; font-weight: bold; display: none;"></p>
</div>
<div class="form-group">
<label for="exampleInputPassword1">College Name</label>
Expand Down Expand Up @@ -83,7 +84,6 @@
<option value="Uttar Pradesh">Uttar Pradesh</option>
<option value="Uttarakhand">Uttarakhand</option>
<option value="West Bengal">West Bengal</option>

</select>
</div>
<div class="form-group">
Expand Down Expand Up @@ -117,9 +117,6 @@
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
<!-- <div id="loader">
<p>Checking info...Redirecting...</p>
</div> -->
<script>
const currentYear = new Date().getFullYear();
const graduationYearSelect = document.getElementById('year');
Expand All @@ -130,6 +127,27 @@
graduationYearSelect.appendChild(option);
}

// Real-time email validation and error display
const emailInput = document.getElementById('email');
const emailError = document.getElementById('emailError');

emailInput.addEventListener('input', function () {
const emailValue = emailInput.value;
const allowedDomains = ['gmail.com', 'yahoo.com', 'outlook.com', 'icloud.com', 'hotmail.com'];

if (emailValue) {
const emailDomain = emailValue.split('@')[1]; // Get the domain part of the email
if (!allowedDomains.includes(emailDomain)) {
emailError.textContent = "Please use an email from trusted providers (Gmail, Yahoo, Outlook, etc.)";
emailError.style.display = 'block';
} else {
emailError.style.display = 'none'; // Hide error if domain is valid
}
} else {
emailError.style.display = 'none'; // Hide error if input is empty
}
});

document.getElementById('form').addEventListener('submit', async function (event) {
event.preventDefault();
const name = document.getElementById('name').value;
Expand All @@ -139,9 +157,22 @@
const dept = document.getElementById('dept').value;
const course = document.getElementById('course').value.toUpperCase();
const year = document.getElementById('year').value;

const result = document.getElementById('result');
const result3 = document.getElementById('result3')
const result2 = document.getElementById('result2');
const result3 = document.getElementById('result3');

// Validate email domain again before submission
const allowedDomains = ['gmail.com', 'yahoo.com', 'outlook.com', 'icloud.com', 'hotmail.com'];
const emailDomain = email.split('@')[1]; // Get the domain part of the email
if (!allowedDomains.includes(emailDomain)) {
result2.innerText = "Please use an email from trusted providers (Gmail, Yahoo, Outlook, etc.)";
result2.style.display = "block";
setTimeout(() => {
result2.style.display = "none";
}, 3000);
return; // Stop form submission
}

const data = { name, email, col_name, state, course, year, dept };
const token = localStorage.getItem('accessToken');
Expand Down Expand Up @@ -180,7 +211,7 @@
} catch (error) {
console.error("Error occurred", error);
}
})
});

async function usercheck() {
const token = localStorage.getItem('accessToken');
Expand All @@ -196,9 +227,8 @@
}
}
usercheck();

</script>
</section>
</body>

</html
</html>
Binary file removed public/images/Design 1.png
Binary file not shown.
Binary file added public/images/Design 1.webp
Binary file not shown.
Binary file removed public/images/badge.png
Binary file not shown.
Binary file added public/images/badge.webp
Binary file not shown.
Binary file removed public/images/badges.png
Binary file not shown.
Binary file added public/images/badges.webp
Binary file not shown.
Binary file removed public/images/boost.png
Binary file not shown.
Binary file added public/images/boost.webp
Binary file not shown.
Binary file removed public/images/career.png
Binary file not shown.
Binary file added public/images/career.webp
Binary file not shown.
Binary file removed public/images/career_pic.jpg
Binary file not shown.
Binary file added public/images/career_pic.webp
Binary file not shown.
Binary file removed public/images/collaborate.jpg
Binary file not shown.
Binary file added public/images/collaborate.webp
Binary file not shown.
Binary file removed public/images/connect.png
Binary file not shown.
Binary file added public/images/connect.webp
Binary file not shown.
Binary file removed public/images/connectpeers.png
Binary file not shown.
Binary file added public/images/connectpeers.webp
Binary file not shown.
Binary file removed public/images/dark_mode.png
Binary file not shown.
Binary file added public/images/dark_mode.webp
Binary file not shown.
Binary file removed public/images/explorepapers.png
Binary file not shown.
Binary file added public/images/explorepapers.webp
Binary file not shown.
Binary file removed public/images/follow.jpeg
Binary file not shown.
Binary file added public/images/follow.webp
Binary file not shown.
Binary file removed public/images/logo.png
Binary file not shown.
Binary file added public/images/logo.webp
Binary file not shown.
Binary file removed public/images/moon.png
Binary file not shown.
Binary file added public/images/moon.webp
Binary file not shown.
Binary file removed public/images/plagiarism.png
Binary file not shown.
Binary file added public/images/plagiarism.webp
Binary file not shown.
Binary file removed public/images/sun.png
Binary file not shown.
Binary file added public/images/sun.webp
Binary file not shown.
Binary file removed public/images/upload-image.jpg
Binary file not shown.
Binary file added public/images/upload-image.webp
Binary file not shown.
1 change: 0 additions & 1 deletion public/images/wave.svg

This file was deleted.

Binary file added public/images/wave.webp
Binary file not shown.
20 changes: 10 additions & 10 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ <h2>About Us</h2>
<div class="slider">
<div class="list">
<div class="item">
<img src="images/Design 1.png" alt="">
<img src="images/Design 1.webp" alt="">
</div>
<div class="item">
<img src="images/connect.png" alt="">
<img src="images/connect.webp" alt="">
</div>
<div class="item">
<img src="images/career_pic.jpg" alt="">
<img src="images/career_pic.webp" alt="">
</div>
<div class="item">
<img src="images/collaborate.jpg" alt="">
<img src="images/collaborate.webp" alt="">
</div>
<div class="item">
<img src="images/badges.png" alt="">
<img src="images/badges.webp" alt="">
</div>
</div>
<div class="buttons">
Expand Down Expand Up @@ -210,35 +210,35 @@ <h3>Top Services</h3>
<div class="all-boxes">
<div class="box show hidden">
<h3>Plagiarism Checker</h3>
<img src="images/plagiarism.png" alt="Plagiarism Checker Icon" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<img src="images/plagiarism.webp" alt="Plagiarism Checker Icon" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<p>
Ensure your content is original with our advanced plagiarism detection tool, and receive detailed reports to uphold integrity in your writing.
</p>
</div>
<div class="box show hidden">
<h3>Explore Papers</h3>
<img src="images/explorepapers.png" alt="project" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<img src="images/explorepapers.webp" alt="project" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<p>Experience seamless research collaboration as students, stakeholders, and faculty connect easily.
Turn submissions into impactful evaluations with a few clicks!
</p>
</div>

<div class="box show hidden">
<h3>Follow Groups</h3>
<img src="images/follow.jpeg" alt="follow group" style="width:200; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<img src="images/follow.webp" alt="follow group" style="width:200; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<p>Stay in the loop with your favorite research groups follow, engage, and collaborate on the topics that matter most.</p>
</div>
<div class="box show hidden">
<h3>Boost Level</h3>
<img src="images/boost.png" alt="boost" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<img src="images/boost.webp" alt="boost" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<p>Amplify your academic reach boost your growth with a network that supports and inspires
with powerful partnerships, transforming ideas into impactful research outcomes.
</p>
</div>

<div class="box show hidden">
<h3>Career Opportunities</h3>
<img src="images/career.png" alt="career" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<img src="images/career.webp" alt="career" style="width:150; height: 150px; border-radius: 15px; border: 2px solid #ccc;">
<p>Turn your academic achievements into career opportunities, opening doors to roles that match your expertise and aspirations.
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions public/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
<div class="container">
<div class="image">
<img src="images/logo.png" alt="">
<img src="images/logo.webp" alt="">
</div>
<div id="box2">
<p>Sorry! User not found</p>
Expand Down
6 changes: 3 additions & 3 deletions public/main_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<header>
<div class="head">
<div class="logo"><img src="images/logo.png" alt="" width="160px"></div>
<div class="logo"><img src="images/logo.webp" alt="" width="160px"></div>
<div id="heading" style="font-size: 34px;color: white;">Research Nexas</div>
<div>
<a href="dashboard.html" title="View Profile"><i class="fa-solid fa-user"
Expand Down Expand Up @@ -93,7 +93,7 @@ <h2>Preview Past Papers</h2>
<a href="">View Papers<i class="fa-sharp fa-solid fa-eye" style="padding: 0px 12px;"></i></a>
</div>
<div class="pyq_images">
<img src="images/connect.png" alt="">
<img src="images/connect.webp" alt="">
</div>
</div>
</section>
Expand All @@ -113,7 +113,7 @@ <h2>Approval</h2>

</div>
<div class="approval_images">
<img src="images/badges.png" alt="">
<img src="images/badges.webp" alt="">
</div>
</div>
</main>
Expand Down
4 changes: 2 additions & 2 deletions public/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
<div class="container">
<div class="image">
<img src="images/logo.png" alt="">
<img src="images/logo.webp" alt="">
</div>
<div id="box2">
<p>Please Try Again!! Account Already Exists</p>
Expand Down
4 changes: 2 additions & 2 deletions public/stk_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</head>

<body>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
<div class="container">
<div class="image">
<img src="images/logo.png" alt="">
<img src="images/logo.webp" alt="">
</div>
<div id="box2">
<p>Sorry! User not found</p>
Expand Down
6 changes: 3 additions & 3 deletions public/stk_mainpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

<body>
<div class="head">
<div class="logo"><img src="images/logo.png" alt="" width="160px"></div>
<div class="logo"><img src="images/logo.webp" alt="" width="160px"></div>
<div id="heading" style="font-size: 34px;color: white;">Research Nexas</div>
<div>
<a href="stk_dashboard.html" title="View Profile"><i class="fa-solid fa-user"
style="font-size: 30px;padding: 12px 13px;border:3px solid white;border-radius:50%;color:white"></i></a>
</div>
<img src="images/moon.png" id="icon">
<img src="images/moon.webp" id="icon">
</div>
<main>
<div class="main">
Expand Down Expand Up @@ -77,7 +77,7 @@ <h2>Paper Allotment</h2>
nostrum excepturi, et aliquam quos?</p>
</div>
<div class="image">
<img src="images/career_pic.jpg" alt="">
<img src="images/career_pic.webp" alt="">
</div>
</div>
<div id="criteria">
Expand Down
Loading