diff --git a/account.php b/account.php index 7c08391..525e3df 100644 --- a/account.php +++ b/account.php @@ -163,98 +163,10 @@ - - - + - diff --git a/app/account/account.php b/app/account/account.php index 4553030..4269257 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -429,7 +429,7 @@ if (isset($_POST['submit_signup'])) { |------------------------------------------------------------- */ if (isset($_POST['toggle_admin'])) { - if ($user_info->is_admin($conn, $_POST['userId'])) { + if ($user_info->is_admin($conn, $_SESSION['id'])) { $is_admin = mysqli_query($conn, "SELECT * FROM users WHERE id = " . $_POST['id'] . " ORDER BY id DESC LIMIT 1"); while ($user_info = mysqli_fetch_assoc($is_admin)) { diff --git a/scripts/account.js b/scripts/account.js new file mode 100644 index 0000000..5846c29 --- /dev/null +++ b/scripts/account.js @@ -0,0 +1,92 @@ +function userResetPassword(id, username) { + var header = "UwU whats the new passywassy code?"; + var description = "Do this only if "+username+" has forgotten their password, DO NOT abuse this power"; + var actionBox = "
"; + + flyoutShow(header, description, actionBox); + + $("#userResetPasswordForm").submit(function(event) { + event.preventDefault(); + var new_passowrd = $("#userNewPassword").val(); + var confirm_password = $("#userConfirmSassword").val(); + var submit = $("#userPasswordSubmit").val(); + var userId = $("#userPasswordSubmit").val(); + $("#sniffle").load("app/account/password_reset.php", { + new_passowrd: new_passowrd, + confirm_password: confirm_password, + id: userId, + submit: submit + }); + }); +} +function userDelete(id, username) { + var header = "Are you very very sure?"; + var description = "This CANNOT be undone, be very carefull with your decition..."; + var actionBox = "\ + "; + + flyoutShow(header, description, actionBox); + + /*$("#descriptionConfirm").submit(function(event) { + event.preventDefault(); + var descriptionInput = $("#descriptionInput").val(); + var userDeleteSubmit = $("#userDeleteSubmit").val(); + $("#sniffle").load("path/to/.php", { + id: id, + submit_delete: userDeleteSubmit + }); + });*/ + /*$("#descriptionConfirm").submit(function(event) { + event.preventDefault(); + var descriptionInput = $("#descriptionInput").val(); + var userDeleteSubmit = $("#userDeleteSubmit").val(); + $("#sniffle").load("path/to/.php", { + id: id, + submit_delete: userDeleteSubmit + }); + });*/ +} +function userToggleAdmin(id, username) { + var header = "With great power comes great responsibility..."; + var description = "Do you trust this user? With admin permitions they can cause a whole lot of damage to this place, so make sure you're very very sure"; + var actionBox = ""; + + flyoutShow(header, description, actionBox); + + $("#toggleAdminConfirm").submit(function(event) { + event.preventDefault(); + var toggleAdminSubmit = $("#toggleAdminSubmit").val(); + $("#sniffle").load("app/account/account.php", { + id: toggleAdminSubmit, + toggle_admin: toggleAdminSubmit + }); + }); +} + +function openTab(evt, tabName) { + var i, tabcontent, tablinks; + + tabcontent = document.getElementsByClassName("tabcontent"); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + } + + tablinks = document.getElementsByClassName("tablinks"); + for (i = 0; i < tablinks.length; i++) { + tablinks[i].className = tablinks[i].className.replace(" active-tab", ""); + } + + document.getElementById(tabName).style.display = "flex"; + evt.currentTarget.className += " active-tab"; +} \ No newline at end of file