I had to change the code of template.html and now {CUSTOM_LOGINBOX} appears after {GALLERY} so I modified your code. Everything works but the user stats don't show up anymore. What am I doing wrong?
// Mod for custom login box + statistics
$query = "SELECT COUNT(OWNER_ID) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID;
$result = mysql_query($query);
$total_upload = mysql_fetch_assoc($result);
mysql_free_result($result);
$query = "SELECT COUNT(author_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = ".USER_ID;
$result = mysql_query($query);
$total_comments = mysql_fetch_assoc($result);
mysql_free_result($result);
$query = "SELECT user_regdate FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID;
$result = mysql_query($query);
$regdate = mysql_fetch_assoc($result);
mysql_free_result($result);
$custom_login_box = <<<EOT
<form action="login.php?referer=index.php" method="post" name="loginbox" style="margin: 0;"></p>
<p>Username<br /><input type="text" class="login_field" name="username" style="width:115px; height:18px;" tabindex="1" /></p>
<p>Password<br /><input type="password" class="login_field" name="password" style="width:115px; height:18px;" tabindex="2" /></p>
<p><input type="submit" name="submitted" value="Login" tabindex="4" /> <input name="remember_me" type="checkbox" value="1" tabindex="3"
/>remember me</p></p>
<p><a href="forgot_passwd.php">I forgot my password</p>
</form>
EOT;
function pagefooter()
{
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
global $template_footer, $custom_login_box;
if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}
// Mod for custom login box + statistics - Begin
$custom_username = stripslashes(USER_NAME);
if(USER_ID)
$custom_login_box = <<<EOT
<span>Welcome {$custom_username}</span><br />
Member since <span >{$regdate['user_regdate']}</span><br />
<span>{$total_upload['COUNT(OWNER_ID)']}</span> files uploaded<br />
<span>{$total_comments['COUNT(author_id)']}</span> comments<br />
EOT;
// Mod for custom login box + statistics - End
$template_vars = array(
'{CUSTOM_LOGINBOX}' => $custom_login_box, // Mod for Custom login box + statistics
);
echo template_eval($template_footer, $template_vars);
}