System log of events

Hi guys,
just wondering if there’s a way to download/export system log …

Not as it stands afaik, but the following code will allow you to run a mini-program to print it out in a browser page, then you can copy and paste it as required.

Is this of use?

Save the code as a php file in your phpList directory and add it’s file name to the allow filematch list in .htaccess In my example I call it dbprint so like this:

<FilesMatch "(index.php|dl.php|ut.php|lt.php|download.php|connector.php|dbprint.php)$">
Order allow,deny
allow from all

The code for dbprint.php:


if (isset($_SERVER['ConfigFile']) && is_file($_SERVER['ConfigFile'])) {
    include $_SERVER['ConfigFile'];
} elseif (is_file('config/config.php')) {
    include 'config/config.php';
} else {
    print "Error, cannot find config file\n";

$servername = $database_host;
$username = $database_user;
$password = $database_password;
$dbname = $database_name;
$table = $table_prefix."eventlog";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());

$sql = "SELECT id, entered, entry FROM $table";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "id: " . $row["id"]. " - Date: " . $row["entered"]. " " . $row["entry"]. "<br>";
} else {
    echo "0 results";


By the way, the code expects to find the config.php file in your config/ directory as this is where it grabs the database info.

Thanks Dragonrider, I’ll give it a try then I’ll come back to you

@edorizzi I’ve taken Dragonrider’s code and put it into a plugin so that it can be run from within phplist. See

@Dragonrider if you have many similar scripts then you might want to extend the plugin by adding further pages. Because the page runs within phplist it doesn’t need the config file, database parameters and connection, so is a bit simpler and shorter.

Thanks Duncan, appreciate the extra work done.

In fact, despite adding dbprint.php in .htaccess, I was not able to see it running.
I put the script under phplist/ , when calling it I get error 403

You don’t have permission to access /phplist/dbprint.php on this server.

I’m going to try the plugin

@edorizzi did you also make the change to the .htaccess file?

The plugin even allows for a CSV file to be opened in Excel so Duncan’s upgraded my code snippet.

yes I made the changes in the .htaccess with no success, but …

… I just tested the plugin and it is working perfectly !!

In excel I had to import the .CSV rather than open it directly, but it works. Only a little mess with long system messages, but I can deal with it :wink:
Thank you !!

like export bounced users ? :wink:

I don’t use this option on my installations, I assume the db record used is _bounce? If someone can confirm this please?

I’ve already created an option to export blacklisted users if anyone is interested.

The Bounce Statistics plugin might do what you want.

You can view and export blacklisted subscribers using the Subscribers plugin.

Thanks Duncan … and sorry for this very late reply …