diff --git a/client.php b/client.php index 8e07ecac..a8943b74 100644 --- a/client.php +++ b/client.php @@ -1,11 +1,17 @@ +

Nothing to see here

"; + }else{ $row = mysqli_fetch_array($sql); $client_name = $row['client_name']; @@ -157,6 +163,8 @@ if(isset($_GET['client_id'])){ diff --git a/dashboard.php b/dashboard.php index e8e45617..05b9ab73 100644 --- a/dashboard.php +++ b/dashboard.php @@ -14,11 +14,11 @@ if(isset($_GET['year'])){ } //GET unique years from expenses, payments and revenues -$sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses UNION DISTINCT SELECT YEAR(payment_date) FROM payments UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues ORDER BY all_years DESC"); +$sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses WHERE company_id = $session_company_id UNION DISTINCT SELECT YEAR(payment_date) FROM payments WHERE company_id = $session_company_id UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues WHERE company_id = $session_company_id ORDER BY all_years DESC"); //GET unique years from expenses, payments and revenues -$sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses UNION DISTINCT SELECT YEAR(payment_date) FROM payments UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues ORDER BY all_years DESC"); +$sql_payment_years = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses WHERE company_id = $session_company_id UNION DISTINCT SELECT YEAR(payment_date) FROM payments WHERE company_id = $session_company_id UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues WHERE company_id = $session_company_id ORDER BY all_years DESC"); //Define var so it doesnt throw errors in logs $largest_income_month = 0; diff --git a/login.php b/login.php index 530c0073..12d45f9e 100644 --- a/login.php +++ b/login.php @@ -7,6 +7,16 @@ if(!file_exists('config.php')){ ?> + + + Invalid Code. @@ -48,6 +64,8 @@ if(isset($_POST['login'])){ } }else{ + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login Failed', log_description = '$email failed to login from $ip using $os | $browser on a $device', log_created_at = NOW()"); + $response = "
Incorrect email or password. diff --git a/logs.php b/logs.php new file mode 100644 index 00000000..647b2fad --- /dev/null +++ b/logs.php @@ -0,0 +1,105 @@ + $sb, 'o' => $o))); + + if(isset($_GET['p'])){ + $p = intval($_GET['p']); + $record_from = (($p)-1)*10; + $record_to = 10; + }else{ + $record_from = 0; + $record_to = 10; + $p = 1; + } + + if(isset($_GET['q'])){ + $q = mysqli_real_escape_string($mysqli,$_GET['q']); + }else{ + $q = ""; + } + + if(!empty($_GET['sb'])){ + $sb = mysqli_real_escape_string($mysqli,$_GET['sb']); + }else{ + $sb = "log_id"; + } + + if(isset($_GET['o'])){ + if($_GET['o'] == 'ASC'){ + $o = "ASC"; + $disp = "DESC"; + }else{ + $o = "DESC"; + $disp = "ASC"; + } + }else{ + $o = "DESC"; + $disp = "ASC"; + } + + $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM logs + WHERE log_type LIKE '%$q%' OR log_description = '%$q%' + ORDER BY $sb $o LIMIT $record_from, $record_to"); + + $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); + $total_found_rows = $num_rows[0]; + $total_pages = ceil($total_found_rows / 10); + +?> + +
+
+
Logs
+
+
+
+
+ +
+ +
+
+
+
+
+ + "> + + + + + + + + + + + + + + + + + + +
TypeDescriptionTimestamp
+ + + +
+
+
+ +Categories Users Companies + Logs
\ No newline at end of file