-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdatabasetest.php
More file actions
44 lines (40 loc) · 1.4 KB
/
Copy pathdatabasetest.php
File metadata and controls
44 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
* Copyright (c) 2019 António 'Tó' Godinho <to@isec.pt>.
* This program is free software; Distributed under the terms of the GNU GPL v3.
*/
# see if database is populated correctly, if not then JS alert to user.
require "./db_ossec.php";
$query = "SELECT count(id) as res_count FROM alert";
$stmt = $pdo->prepare($query);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$row = $stmt->fetch();
if (!$row['res_count'] > 0) {
echo "alert(\"Connected to database ok, but no alerts found. Ensure OSSEC is logging to your database.\");";
}
} else {
echo "alert(\"Problems checking database for information\");";
}
$query = "SELECT count(id) as res_count FROM data";
$stmt = $pdo->prepare($query);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$row = $stmt->fetch();
if (!$row['res_count'] > 0) {
echo "alert(\"Connected to database ok, but no data found. Ensure OSSEC is logging to your database.\");";
}
} else {
echo "alert(\"Problems checking database for information\");";
}
$query = "SELECT count(id) as res_count FROM location";
$stmt = $pdo->prepare($query);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$row = $stmt->fetch();
if (!$row['res_count'] > 0) {
echo "alert(\"Connected to database ok, but no data found. Ensure OSSEC is logging to your database.\");";
}
} else {
echo "alert(\"Problems checking database for information\");";
}