adding server log

This commit is contained in:
jakani24
2024-06-08 20:05:25 +02:00
parent f67b0b87e8
commit e9e7340e96
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
function log($loglevel,$logtext,$userid){ function log_action($loglevel,$logtext,$userid){
include "../../../config.php"; include "../../../config.php";
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
if ($conn->connect_error) { if ($conn->connect_error) {

View File

@@ -4,6 +4,7 @@ if(isset($_SESSION["login"])){
header("LOCATION:/system/secure_zone/php/index.php"); header("LOCATION:/system/secure_zone/php/index.php");
} }
include "../../../api/php/notifications/sendmessage.php"; //to send user notification on login include "../../../api/php/notifications/sendmessage.php"; //to send user notification on login
include "../../../api/php/log/add_server_entry.php"; //to log things
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@@ -320,7 +321,7 @@ async function checkRegistration() {
//send the user to 2fa auth page //send the user to 2fa auth page
echo '<script>window.location.href = "/system/insecure_zone/php/2fa.php";</script>'; echo '<script>window.location.href = "/system/insecure_zone/php/2fa.php";</script>';
}else{ }else{
log_action("LOGIN::SUCCESS","User ".$_SESSION["username"]." logged in with password.",$_SESSION["id"]);
if($_SESSION["send_login_message"]=="1"){ if($_SESSION["send_login_message"]=="1"){
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
$username=$row["username"]; $username=$row["username"];