I'm really no php pro, but I'm trying to put together my own extern.php that I can include anywhere on my site.
What do I have to add/change/remove to make this work?
Any help will be greatly appreciated.
This is what I have so far (parts from the original extern.php):
<?php
$connect = mysql_connect("localhost","","");
//
// Show board statistics
//
if ($_GET['action'] == 'stats')
{
// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);
$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);
$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
echo $lang_index['No of users'].' : '.$stats['total_users'].'<br />';
echo $lang_index['No of topics'].' : '.$stats['total_topics'].'<br />';
echo $lang_index['No of posts'].' : '.$stats['total_posts'].'<br /><br />';
echo $lang_index['Newest user'].' : <a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>';
return;
}
?>