-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpbb_list.php
More file actions
96 lines (80 loc) · 3.09 KB
/
phpbb_list.php
File metadata and controls
96 lines (80 loc) · 3.09 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
function xmlspecialchars($text) {
return str_replace('-' , ' ' , str_replace(''', ''', htmlspecialchars($text, ENT_QUOTES)));
}
include 'utils_functions.php';
include "settings.php";
include ($configPath);
$logType = '[utils]';
echo "Environment: $environment";
newline();
// get DB creds from forum config, AWS creds are in config as well but we don't rename them
$f_username=$dbuser;
$f_password=$dbpasswd;
$f_database=$dbname;
$f_server=$dbhost;
// define forum mysqli connection
// TODO Move this to SSL
$f_mysqli = new mysqli($f_server, $f_username, $f_password, $f_database);
// Check forum connection
if (mysqli_connect_errno($f_mysqli))
{
echo logEvent("Failed to connect to forum MySQL $f_server/$f_database: " . mysqli_connect_error());
exit();
} else {
echo nl2br ("Connected to forum database: $f_server/$f_database \n" ) ;
} ;
// $mode = $_GET[mode];
$query = 'select '
. ' phpbb_users.user_id ,'
. ' phpbb_users.username ,'
. ' phpbb_users.user_email, '
. ' phpbb_users.user_sig, '
. ' pf_phpbb_occupation, '
. ' pf_phpbb_interests, '
. ' from_unixtime(phpbb_users.user_lastvisit) as lastvisit, '
. ' phpbb_profile_fields_data.user_id ,'
. ' phpbb_profile_fields_data.pf_airport_id ,'
. ' airports.apt_id ,'
. ' airports.apt_name ,'
. ' airports.lat ,'
. ' airports.city ,'
. ' airports.state ,'
. ' airports.lon'
. ' from phpbb_users,'
. ' phpbb_profile_fields_data ,'
. ' airports'
. ' where '
. ' phpbb_profile_fields_data.pf_pilot_yn = 1 and '
. ' user_inactive_reason = 0 and /* include active only, exclude deactivated users */ '
. ' phpbb_profile_fields_data.user_id = phpbb_users.user_id and '
. ' airports.apt_id = UCASE(phpbb_profile_fields_data.pf_airport_id) '
. ' order by airports.state, phpbb_users.user_lastvisit desc ;'
. ' ';
// create table headers
echo '<html><body><table border=1><tr><th>UserName</th><th>Last Visit</th><th>City</th><th>State</th>'
. '<th>Airport</th><th>Email</th><th>Sig</th><th>Occ</th><th>Interests</th></tr>';
// run query
$result=$f_mysqli->query($query);
if(!$result) {
echo logEvent("Error $f_mysqli->error , exiting. Query: $queryMaxUserForum");
} else {
$rowsReturned = $result->num_rows;
echo nl2br ("Rows returned: $rowsReturned \n") ;
echo nl2br ("Only forum users where Pilot=Y and currently active are shown. \n") ;
while($row = $result->fetch_assoc()) {
echo '<tr><td>' . $row['username'] . '</td>'
. '<td>' . $row["lastvisit"] . '  </td>'
. '<td>' . $row["city"] . '</td>'
. '<td>' . $row["state"] . '</td>'
. '<td>' . $row["apt_id"] . '</td>'
. '<td>' . $row["user_email"] . '</td>'
. '<td>' . $row["user_sig"] . '  </td>'
. '<td>' . $row["pf_phpbb_occupation"] . '  </td>'
. '<td>' . $row["pf_phpbb_interests"] . '  </td>'
. '</tr>' ;
}
}
echo
'</table><br>'. $i . ' Pilots Listed<br></body></html>';
?>