forked from ECSC/analogi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdatabasetest.php
51 lines (43 loc) · 1.3 KB
/
databasetest.php
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
45
46
47
48
49
50
51
<?php
/*
* Copyright (c) 2012 Andy 'Rimmer' Shepherd <[email protected]> (ECSC Ltd).
* 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.
$query="SELECT count(id) as res_count
FROM alert";
if($result=mysql_query($query, $db_ossec)){
$row = @mysql_fetch_assoc($result);
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";
if($result=mysql_query($query, $db_ossec)){
$row = @mysql_fetch_assoc($result);
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";
if($result=mysql_query($query, $db_ossec)){
$row = @mysql_fetch_assoc($result);
if(!$row['res_count']>0){
echo "
alert(\"Connected to database ok, but no locations found. Ensure OSSEC is logging to your database.\");";
}
}else{
echo "
alert(\"Problems checking database for information\");";
}
?>