commit jun 24

This commit is contained in:
2024-06-24 09:42:54 +02:00
parent 6e1ecbc485
commit d0f1607632
9 changed files with 383 additions and 208 deletions

View File

@@ -73,7 +73,7 @@
<div class="horizontal-menu d-none d-md-none d-lg-flex "> <div class="horizontal-menu d-none d-md-none d-lg-flex ">
<ul class="nav-ul-hor d-md-flex d-md-row s mb-0"> <ul class="nav-ul-hor d-md-flex d-md-row s mb-0">
<a href="index.php" style="text-decoration: none;"> <a href="index.php" style="text-decoration: none;">
<li class="navs" id="li-people"> Home <li class="navs" id="li-people"> Home
<ul class="dropdown-ul-2" style="left: 25%"> <ul class="dropdown-ul-2" style="left: 25%">
<li>Case studies</li> <li>Case studies</li>
<li>Footer</li> <li>Footer</li>
@@ -82,14 +82,14 @@
</a> </a>
<a href="people.php" style="text-decoration: none;"> <a href="people.php" style="text-decoration: none;">
<li class="navs" id="li-people">People <li class="navs" id="li-people">People
<ul class="dropdown-ul-2" style="left: 31%"> <ul class="dropdown-ul-2" style="left: 31%">
<li>Main team</li> <li>Main team</li>
<li>Others</li> <li>Others</li>
</ul> </ul>
</li> </li>
</a> </a>
<li id="li-home" class="navs">About us <li id="li-home" class="navs">About us
<ul class="dropdown-ul-2" style="left: 36%"> <ul class="dropdown-ul-2" style="left: 36%">
<a href="#faq"> <a href="#faq">
<li>FAQ</li> <li>FAQ</li>
</a> </a>
@@ -116,19 +116,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -563,38 +580,40 @@
</div> </div>
</section> </section>
<!-- footer --> <!-- footer -->
<footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5"> <footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5">
<div class="scrollToTopBtn"> <div class="scrollToTopBtn">
<button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button> <button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
<img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt=""> <img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt="">
<div class="footer-copyright"> <div class="footer-copyright">
(c)2024 Globaly. All rights reserved. | (c)2024 Globaly. All rights reserved. |
<a href="#">Privacy Policy</a> <a href="#">Privacy Policy</a>
</div> </div>
</footer> </footer>
<script> <script>
// Get the button // Get the button
let mybutton = document.getElementById("scrollToTopBtn"); let mybutton = document.getElementById("scrollToTopBtn");
window.onscroll = function() {scrollFunction()}; window.onscroll = function() {
scrollFunction()
};
function scrollFunction() { function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block"; mybutton.style.display = "block";
} else { } else {
mybutton.style.display = "none"; mybutton.style.display = "none";
} }
} }
// When the user clicks on the button, scroll to the top of the document // When the user clicks on the button, scroll to the top of the document
function topFunction() { function topFunction() {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
} }
</script> </script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

View File

@@ -11,7 +11,7 @@ if (mysqli_select_db($con, $mysql_db)) {
mysqli_query($con, $delete_query); mysqli_query($con, $delete_query);
} }
$query = "SELECT `name`, `surname`, `email`, `birth_day`, `birth_month`, `birth_year` FROM `globaly_accounts`"; $query = "SELECT `name`, `surname`, `email`, `birth_day`, `birth_month`, `birth_year`, `city` FROM `globaly_accounts`";
$query_run = mysqli_query($con, $query); $query_run = mysqli_query($con, $query);
if (mysqli_num_rows($query_run) > 0) { if (mysqli_num_rows($query_run) > 0) {
@@ -21,6 +21,7 @@ if (mysqli_select_db($con, $mysql_db)) {
<th>Surname</th> <th>Surname</th>
<th>Email</th> <th>Email</th>
<th>Birth Date</th> <th>Birth Date</th>
<th>City</th>
<th>Edit</th> <th>Edit</th>
</tr>'; </tr>';
@@ -29,18 +30,20 @@ if (mysqli_select_db($con, $mysql_db)) {
$surname = $query_row['surname']; $surname = $query_row['surname'];
$email = $query_row['email']; $email = $query_row['email'];
$birth_date = $query_row['birth_day'] . '.' . $query_row['birth_month'] . '.' . $query_row['birth_year'] . '.'; $birth_date = $query_row['birth_day'] . '.' . $query_row['birth_month'] . '.' . $query_row['birth_year'] . '.';
$city = $query_row['city'];
echo '<tr> echo '<tr>
<td>' . htmlspecialchars($name) . '</td> <td>' . htmlspecialchars($name) . '</td>
<td>' . htmlspecialchars($surname) . '</td> <td>' . htmlspecialchars($surname) . '</td>
<td>' . htmlspecialchars($email) . '</td> <td>' . htmlspecialchars($email) . '</td>
<td>' . htmlspecialchars($birth_date) . '</td> <td>' . htmlspecialchars($birth_date) . '</td>
<td>' . htmlspecialchars($city) . '</td>
<td id="edit-td"> <td id="edit-td">
<form id="delete-form" method="POST" action=""> <form id="delete-form" method="POST" action="">
<input type="hidden" name="delete_email" value="' . htmlspecialchars($email) . '"> <input type="hidden" name="delete_email" value="' . htmlspecialchars($email) . '">
<button id="delete-btn" type="submit"><i class="fa-regular fa-circle-xmark"></i></button> <button id="delete-btn" type="submit"><i class="fa-regular fa-circle-xmark"></i></button>
</form> </form>
<a id="edit-user" href="edit-user.php"><i class="fa-solid fa-user-pen"></i></a> <a id="edit-user" href="edit-user.php?name=' . urlencode($name) . '&surname=' . urlencode($surname) . '&email=' . urlencode($email) . '&birth_day=' . urlencode($query_row['birth_day']) . '&birth_month=' . urlencode($query_row['birth_month']) . '&birth_year=' . urlencode($query_row['birth_year']) . '&city=' . urlencode($query_row['city']) . '"><i class="fa-solid fa-user-pen"></i></a>
</td> </td>
</tr>'; </tr>';
} }

View File

@@ -94,20 +94,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -339,38 +355,40 @@
</div> </div>
</section> </section>
<!-- footer --> <!-- footer -->
<footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5"> <footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5">
<div class="scrollToTopBtn"> <div class="scrollToTopBtn">
<button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button> <button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
<img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt=""> <img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt="">
<div class="footer-copyright"> <div class="footer-copyright">
(c)2024 Globaly. All rights reserved. | (c)2024 Globaly. All rights reserved. |
<a href="#">Privacy Policy</a> <a href="#">Privacy Policy</a>
</div> </div>
</footer> </footer>
<script> <script>
// Get the button // Get the button
let mybutton = document.getElementById("scrollToTopBtn"); let mybutton = document.getElementById("scrollToTopBtn");
window.onscroll = function() {scrollFunction()}; window.onscroll = function() {
scrollFunction()
};
function scrollFunction() { function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block"; mybutton.style.display = "block";
} else { } else {
mybutton.style.display = "none"; mybutton.style.display = "none";
} }
} }
// When the user clicks on the button, scroll to the top of the document // When the user clicks on the button, scroll to the top of the document
function topFunction() { function topFunction() {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
} }
</script> </script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

View File

@@ -94,20 +94,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -238,38 +254,40 @@
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d691259.3591892968!2d-77.60275823607651!3d38.56325402877762!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89b64de885e53a9d%3A0x67e76f2416faa504!2z0KHQv9GA0LjQvdCz0YTQuNC70LQsINCS0LjRgNGf0LjQvdC40ZjQsCwg0KHRmNC10LTQuNGa0LXQvdC1INCU0YDQttCw0LLQtQ!5e0!3m2!1ssr!2srs!4v1718006987157!5m2!1ssr!2srs" width="100%" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d691259.3591892968!2d-77.60275823607651!3d38.56325402877762!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89b64de885e53a9d%3A0x67e76f2416faa504!2z0KHQv9GA0LjQvdCz0YTQuNC70LQsINCS0LjRgNGf0LjQvdC40ZjQsCwg0KHRmNC10LTQuNGa0LXQvdC1INCU0YDQttCw0LLQtQ!5e0!3m2!1ssr!2srs!4v1718006987157!5m2!1ssr!2srs" width="100%" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div> </div>
</section> </section>
<!-- footer --> <!-- footer -->
<footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5"> <footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5">
<div class="scrollToTopBtn"> <div class="scrollToTopBtn">
<button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button> <button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
<img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt=""> <img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt="">
<div class="footer-copyright"> <div class="footer-copyright">
(c)2024 Globaly. All rights reserved. | (c)2024 Globaly. All rights reserved. |
<a href="#">Privacy Policy</a> <a href="#">Privacy Policy</a>
</div> </div>
</footer> </footer>
<script> <script>
// Get the button // Get the button
let mybutton = document.getElementById("scrollToTopBtn"); let mybutton = document.getElementById("scrollToTopBtn");
window.onscroll = function() {scrollFunction()}; window.onscroll = function() {
scrollFunction()
};
function scrollFunction() { function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block"; mybutton.style.display = "block";
} else { } else {
mybutton.style.display = "none"; mybutton.style.display = "none";
} }
} }
// When the user clicks on the button, scroll to the top of the document // When the user clicks on the button, scroll to the top of the document
function topFunction() { function topFunction() {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
} }
</script> </script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

View File

@@ -116,42 +116,60 @@
</style> </style>
</head> </head>
<?php
require 'php/connect.inc.php';
$name = htmlspecialchars($_GET['name']);
$surname = htmlspecialchars($_GET['surname']);
$email = htmlspecialchars($_GET['email']);
$birth_day = htmlspecialchars($_GET['birth_day']);
$birth_month = htmlspecialchars($_GET['birth_month']);
$birth_year = htmlspecialchars($_GET['birth_year']);
$city = htmlspecialchars($_GET['city']);
?>
<body> <body>
<div class="form d-flex flex-column align-items-center justify-content-center my-md-5 mb-5 mb-lg-0"> <div class="form d-flex flex-column align-items-center justify-content-center my-md-5 mb-5 mb-lg-0">
<div class="headline-card d-flex flex-column align-items-center justify-content-center mt-4"> <div class="headline-card d-flex flex-column align-items-center justify-content-center mt-4">
<h2>Edit user</h2> <h2>Edit user</h2>
<img class="line-img" src="assets/images/line.png" alt=""> <img class="line-img" src="assets/images/line.png" alt="">
</div> </div>
<form action="php/add_user_register.php" method="post"> <form action="php/update-user.php" method="post">
<div class="form-container-bot d-flex flex-column align-items-start justify-content-center"> <div class="form-container-bot d-flex flex-column align-items-start justify-content-center">
<input class="input-text" type="text" placeholder="User's Name" name="name"> <input class="input-text" type="text" name="name" value="<?php echo $name; ?>">
<input class="input-text" type="text" placeholder="User's Surname" name="surname"> <input class="input-text" type="text" name="surname" value="<?php echo $surname; ?>">
<input class="input-text" type="text" placeholder="User's Email" name="email"> <input class="input-text" type="text" name="email" value="<?php echo $email; ?>">
<input class="input-text" type="password" id="password" placeholder="Password" name="password"> <input class="input-text" type="password" id="password" placeholder="Password" name="password">
<i id="togglePassword" class="fa-solid fa-eye"></i> <i id="togglePassword" class="fa-solid fa-eye"></i>
<p id="generate-password">generete</p> <p id="generate-password">generate</p>
<input class="input-text" type="password" id="confirm-password" placeholder="Confirm Password" name="password_again"> <input class="input-text" type="password" id="confirm-password" placeholder="Confirm Password" name="password_again">
<input class="input-text" type="text" placeholder="User's City" name="city"> <input class="input-text" type="text" name="city" value="<?php echo $city; ?>">
<h6>Date of birth:</h6> <h6>Date of birth:</h6>
<div class="date-container"> <div class="date-container">
<span>
<span>
<select name="birth_day"> <select name="birth_day">
<?php <?php
$start_date = 1; $start_date = 1;
$end_date = 31; $end_date = 31;
for ($j = $start_date; $j <= $end_date; $j++) { for ($j = $start_date; $j <= $end_date; $j++) {
echo '<option value=' . $j . '>' . $j . '</option>'; $selected = ($j == $birth_day) ? 'selected' : '';
echo '<option value="' . $j . '" ' . $selected . '>' . $j . '</option>';
} }
?> ?>
</select> </select>
</span> </span>
<span> <span>
<select name="birth_month"> <select name="birth_month">
<?php for ($m = 1; $m <= 12; ++$m) { <?php
for ($m = 1; $m <= 12; ++$m) {
$month_label = date('F', mktime(0, 0, 0, $m, 1)); $month_label = date('F', mktime(0, 0, 0, $m, 1));
$selected = ($month_label == $birth_month) ? 'selected' : '';
echo '<option value="' . $month_label . '" ' . $selected . '>' . $month_label . '</option>';
}
?> ?>
<option value="<?php echo $month_label; ?>"><?php echo $month_label; ?></option>
<?php } ?>
</select> </select>
</span> </span>
<span> <span>
@@ -161,7 +179,8 @@
$min = $year - 100; $min = $year - 100;
$max = $year; $max = $year;
for ($i = $max; $i >= $min; $i--) { for ($i = $max; $i >= $min; $i--) {
echo '<option value=' . $i . '>' . $i . '</option>'; $selected = ($i == $birth_year) ? 'selected' : '';
echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
} }
?> ?>
</select> </select>
@@ -172,7 +191,7 @@
<input type="hidden" id="exampleCheckboxValue" name="admin" value="0"> <input type="hidden" id="exampleCheckboxValue" name="admin" value="0">
</div> </div>
</div> </div>
<input class="view-more" type="submit" value="Add user"> <input class="view-more" type="submit" value="Edit user">
</div> </div>
</form> </form>
@@ -260,7 +279,7 @@
$('#generate-password').click(function() { $('#generate-password').click(function() {
const password = generatePassword(8); const password = generatePassword(8);
$('#password').val(password); $('#password').val(password);
$('#confirm-password').val(password); $('#confirm-password').val(password);
}); });
@@ -282,7 +301,7 @@
function isPasswordValid(password) { function isPasswordValid(password) {
if (password.length < 8) { if (password.length < 8) {
return false; return false;
} }
if (!/[a-z]/.test(password)) { if (!/[a-z]/.test(password)) {
return false; return false;
} }
@@ -298,16 +317,16 @@
return true; return true;
} }
function updateCheckboxValue() { function updateCheckboxValue() {
const isChecked = $('#exampleCheckbox').is(':checked'); const isChecked = $('#exampleCheckbox').is(':checked');
$('#exampleCheckboxValue').val(isChecked ? '1' : '0'); $('#exampleCheckboxValue').val(isChecked ? '1' : '0');
} }
$('#exampleCheckbox').change(function() {
updateCheckboxValue();
});
$('#exampleCheckbox').change(function() {
updateCheckboxValue(); updateCheckboxValue();
});
updateCheckboxValue();
}); });
</script> </script>

View File

@@ -95,20 +95,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -568,38 +584,40 @@
</div> </div>
</section> </section>
<!-- footer --> <!-- footer -->
<footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5"> <footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5">
<div class="scrollToTopBtn"> <div class="scrollToTopBtn">
<button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button> <button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
<img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt=""> <img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt="">
<div class="footer-copyright"> <div class="footer-copyright">
(c)2024 Globaly. All rights reserved. | (c)2024 Globaly. All rights reserved. |
<a href="#">Privacy Policy</a> <a href="#">Privacy Policy</a>
</div> </div>
</footer> </footer>
<script> <script>
// Get the button // Get the button
let mybutton = document.getElementById("scrollToTopBtn"); let mybutton = document.getElementById("scrollToTopBtn");
window.onscroll = function() {scrollFunction()}; window.onscroll = function() {
scrollFunction()
};
function scrollFunction() { function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block"; mybutton.style.display = "block";
} else { } else {
mybutton.style.display = "none"; mybutton.style.display = "none";
} }
} }
// When the user clicks on the button, scroll to the top of the document // When the user clicks on the button, scroll to the top of the document
function topFunction() { function topFunction() {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
} }
</script> </script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

View File

@@ -225,20 +225,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -368,8 +384,8 @@
<div class="card4 d-flex align-items-center justify-content-center flex-column mb-4"> <div class="card4 d-flex align-items-center justify-content-center flex-column mb-4">
<img class="img-fourth-au" src="assets/images/team3.jpg" alt=""> <img class="img-fourth-au" src="assets/images/team3.jpg" alt="">
<div class="card-text4 d-flex align-items-center justify-content-start flex-column"> <div class="card-text4 d-flex align-items-center justify-content-start flex-column">
<h4 class="h4-fourth"><?php echo $data[3]['name'] . ' ' . $data[3]['surname']; ?></h4> <h4 class="h4-fourth"><?php echo $data[11]['name'] . ' ' . $data[11]['surname']; ?></h4>
<p class="p-fourth"><?php echo $data[3]['email'] . '<br>' . $data[3]['birth_day'] . '.' . $data[3]['birth_month'] . '.' . $data[3]['birth_year'] . '.'; ?></p> <p class="p-fourth"><?php echo $data[11]['email'] . '<br>' . $data[11]['birth_day'] . '.' . $data[11]['birth_month'] . '.' . $data[11]['birth_year'] . '.'; ?></p>
</div> </div>
</div> </div>
</div> </div>
@@ -395,8 +411,8 @@
<div class="card4 d-flex align-items-center justify-content-center flex-column mb-4"> <div class="card4 d-flex align-items-center justify-content-center flex-column mb-4">
<img class="img-fourth-au" src="assets/images/team6.jpg" alt=""> <img class="img-fourth-au" src="assets/images/team6.jpg" alt="">
<div class="card-text4 d-flex align-items-center justify-content-start flex-column"> <div class="card-text4 d-flex align-items-center justify-content-start flex-column">
<h4 class="h4-fourth"><?php echo $data[6]['name'] . ' ' . $data[6]['surname']; ?></h4> <h4 class="h4-fourth"><?php echo $data[15]['name'] . ' ' . $data[15]['surname']; ?></h4>
<p class="p-fourth"><?php echo $data[6]['email'] . '<br>' . $data[6]['birth_day'] . '.' . $data[6]['birth_month'] . '.' . $data[6]['birth_year'] . '.'; ?></p> <p class="p-fourth"><?php echo $data[15]['email'] . '<br>' . $data[15]['birth_day'] . '.' . $data[15]['birth_month'] . '.' . $data[15]['birth_year'] . '.'; ?></p>
</div> </div>
</div> </div>
</div> </div>
@@ -417,10 +433,11 @@
</thead> </thead>
<tbody> <tbody>
<?php <?php
for ($id = 7; $id <= max(array_keys($data)); $id++) { $maxId = max(array_keys($data));
for ($id = 7; $id <= $maxId; $id++) {
if (isset($data[$id])) { if (isset($data[$id])) {
echo "<tr>"; echo "<tr>";
// Combine key and value for birth date into a formatted string
$birthDate = "{$data[$id]['birth_day']}.{$data[$id]['birth_month']}.{$data[$id]['birth_year']}."; $birthDate = "{$data[$id]['birth_day']}.{$data[$id]['birth_month']}.{$data[$id]['birth_year']}.";
echo "<td class='td-others'>{$data[$id]['name']}</td>"; echo "<td class='td-others'>{$data[$id]['name']}</td>";
@@ -428,13 +445,12 @@
echo "<td class='td-others'>{$data[$id]['email']}</td>"; echo "<td class='td-others'>{$data[$id]['email']}</td>";
echo "<td class='td-others'>$birthDate</td>"; echo "<td class='td-others'>$birthDate</td>";
echo "</tr>"; echo "</tr>";
} else {
echo "<tr><td colspan='4'>No data found for ID $id</td></tr>";
} }
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>

46
php/update-user.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
require 'connect.inc.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Retrieve data from the form
$name = mysqli_real_escape_string($con, $_POST['name']);
$surname = mysqli_real_escape_string($con, $_POST['surname']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$password = mysqli_real_escape_string($con, $_POST['password']);
$password_again = mysqli_real_escape_string($con, $_POST['password_again']);
$city = mysqli_real_escape_string($con, $_POST['city']);
$birth_day = mysqli_real_escape_string($con, $_POST['birth_day']);
$birth_month = mysqli_real_escape_string($con, $_POST['birth_month']);
$birth_year = mysqli_real_escape_string($con, $_POST['birth_year']);
$admin = mysqli_real_escape_string($con, $_POST['admin']);
// Hash the password if it was provided
if (!empty($password) && $password == $password_again) {
$password_hashed = md5($password);
$password_update = "password = '$password_hashed',";
} else {
$password_update = "";
}
$query = "UPDATE `globaly_accounts` SET
name = '$name',
surname = '$surname',
email = '$email',
$password_update
city = '$city',
birth_day = '$birth_day',
birth_month = '$birth_month',
birth_year = '$birth_year',
admin = '$admin'
WHERE email = '$email'";
if (mysqli_query($con, $query)) {
echo '<script type="text/javascript">
alert("You have successfully edit the user!");
window.location.href = "../admin_panel.php";
</script>';
} else {
echo "Error updating user information: " . mysqli_error($con);
}
}
?>

View File

@@ -95,20 +95,36 @@
</ul> </ul>
</div> </div>
<img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt=""> <img src="assets/images/logo.webp" class="logo-img mt-3 mt-lg-0 mt-md-0" alt="">
<div class="dropdown" id="dropdownid" style="position: absolute; width:fit-content;"> <!-- Login -->
<div class="dropdown" id="dropdownid" style="position: absolute; width: fit-content;">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-users"></i> <i class="fa-solid fa-users"></i>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<?php if (loggedin()) { <?php
if (loggedin()) {
echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>'; echo '<li><a class="dropdown-item" href="php/logout.php">Log out</a></li>';
if (is_admin()) {
echo '<li><a class="dropdown-item" href="admin_panel.php">Admin panel</a></li>';
}
} else { } else {
echo '<li><a class="dropdown-item" href="login.html">Log in</a></li> echo '<li><a class="dropdown-item" href="login.html">Log in</a></li>
<li><a class="dropdown-item" href="signup.php">Sign up</a></li>'; <li><a class="dropdown-item" href="signup.php">Sign up</a></li>';
} ?> }
?>
</ul> </ul>
</div> </div>
<!-- Weather icon -->
<?php if (loggedin()) {
echo '<div class="weather-div" style="position: absolute; color: white; font-size: 25px; left:12%; top:15px;">
<a style="color:white" href="weather.php"><i class="fa-solid fa-cloud-sun"></i></a>
<div>';
} ?>
<!-- site navigation--> <!-- site navigation-->
@@ -389,38 +405,40 @@
</div> </div>
</section> </section>
<!-- footer --> <!-- footer -->
<footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5"> <footer class="d-flex flex-column justify-content-center align-items-center pb-4 py-lg-5 py-md-5">
<div class="scrollToTopBtn"> <div class="scrollToTopBtn">
<button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button> <button onclick="topFunction()" id="scrollToTopBtn"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
<img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt=""> <img src="assets/images/footer-logo.webp" class="mt-3 mt-md-0" alt="">
<div class="footer-copyright"> <div class="footer-copyright">
(c)2024 Globaly. All rights reserved. | (c)2024 Globaly. All rights reserved. |
<a href="#">Privacy Policy</a> <a href="#">Privacy Policy</a>
</div> </div>
</footer> </footer>
<script> <script>
// Get the button // Get the button
let mybutton = document.getElementById("scrollToTopBtn"); let mybutton = document.getElementById("scrollToTopBtn");
window.onscroll = function() {scrollFunction()}; window.onscroll = function() {
scrollFunction()
};
function scrollFunction() { function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block"; mybutton.style.display = "block";
} else { } else {
mybutton.style.display = "none"; mybutton.style.display = "none";
} }
} }
// When the user clicks on the button, scroll to the top of the document // When the user clicks on the button, scroll to the top of the document
function topFunction() { function topFunction() {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
} }
</script> </script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>