Mu5icMan
08-22-2005, 08:49 AM
I have this code to display a log of who has downloaded what attachments and need help modifying it to work with 3.5 rc2.
<?php
// SETUP SECURITY BELOW
$fs = array(
// "1" => "22" ... 1 is the forum ID and 22 is the userID. This line will allow access
// to the report for forum 1 only to userID 22. Make sure to add a comma
// if you add a new line.
// Separate userid's with |22|
);
// Nothing to edit below this line...................................
require_once('./global.php');
if (empty($f) or empty($bbuserinfo['userid'])) {
exit;
}
if (!strstr($fs[$f],"|".$bbuserinfo['userid']."|") and $bbuserinfo['usergroupid']!=6) {
show_nopermission();
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Download Report </TITLE>
<style type="text/css">
td,body {
FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
FONT-SIZE: 11px;
COLOR: #000000;
}
</style>
</HEAD>
<BODY>
<font face="arial" size="2">
<?
switch($sort) {
case "username":
$orderby="username DESC";
break;
case "at":
$orderby="attachmentid DESC";
break;
case "dl":
$orderby="total DESC";
break;
case "ld":
$orderby="dateline DESC";
break;
case "ip":
$orderby="ipaddress ASC";
break;
default:
$orderby="username DESC";
}
$forum=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$f'");
echo "<b>".$bbtitle." download report - Forum: <i>".$forum['title']."</i><br /><br />";
echo "<table cellspacing=12><tr><td><a href=\"client_report.php?f=$f&sort=username\">Username</a></td><td><a href=\"client_report.php?f=$f&sort=at\">Attachment</a></td><td><a href=\"client_report.php?f=$f&sort=dl\"># of DL's</a></td><td><a href=\"client_report.php?f=$f&sort=ld\">Last Download</a></td><td><a href=\"client_report.php?f=$f&sort=ip\">IP Address</a></td></tr>";
$reports = $DB_site->query("SELECT u.userid, u.username, d.attachmentid, d.total, d.dateline, d.ipaddress, p.threadid, t.forumid
FROM user u
LEFT JOIN downloads d ON u.userid=d.userid
LEFT JOIN attachment AS a ON a.attachmentid=d.attachmentid
LEFT JOIN post AS p ON p.postid=a.postid
LEFT JOIN thread t ON p.threadid=t.threadid
WHERE t.forumid='$f' ORDER BY $orderby");
while ($report=$DB_site->fetch_array($reports))
{
echo "<tr>";
echo "<td align=\"left\"><a href=\"member.php?action=getinfo&userid=$report[userid]\" target=\"_blank\">".$report['username']."</a></td>";
//echo "<td align=\"center\">".$report['userid']."</td>";
echo "<td align=\"center\"><a href=\"showthread.php?threadid=$report[threadid]\" target=\"_blank\">".$report['attachmentid']."</a></td>";
echo "<td align=\"center\">".$report['total']."</td>";
echo "<td align=\"center\">".date("F j, Y, g:i a",$report['dateline'])."</td>";
echo "<td align=\"center\">".$report['ipaddress']."</td>";
echo "</tr>";
}
?>
</font>
</BODY>
</HTML>
<?php
// SETUP SECURITY BELOW
$fs = array(
// "1" => "22" ... 1 is the forum ID and 22 is the userID. This line will allow access
// to the report for forum 1 only to userID 22. Make sure to add a comma
// if you add a new line.
// Separate userid's with |22|
);
// Nothing to edit below this line...................................
require_once('./global.php');
if (empty($f) or empty($bbuserinfo['userid'])) {
exit;
}
if (!strstr($fs[$f],"|".$bbuserinfo['userid']."|") and $bbuserinfo['usergroupid']!=6) {
show_nopermission();
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Download Report </TITLE>
<style type="text/css">
td,body {
FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
FONT-SIZE: 11px;
COLOR: #000000;
}
</style>
</HEAD>
<BODY>
<font face="arial" size="2">
<?
switch($sort) {
case "username":
$orderby="username DESC";
break;
case "at":
$orderby="attachmentid DESC";
break;
case "dl":
$orderby="total DESC";
break;
case "ld":
$orderby="dateline DESC";
break;
case "ip":
$orderby="ipaddress ASC";
break;
default:
$orderby="username DESC";
}
$forum=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$f'");
echo "<b>".$bbtitle." download report - Forum: <i>".$forum['title']."</i><br /><br />";
echo "<table cellspacing=12><tr><td><a href=\"client_report.php?f=$f&sort=username\">Username</a></td><td><a href=\"client_report.php?f=$f&sort=at\">Attachment</a></td><td><a href=\"client_report.php?f=$f&sort=dl\"># of DL's</a></td><td><a href=\"client_report.php?f=$f&sort=ld\">Last Download</a></td><td><a href=\"client_report.php?f=$f&sort=ip\">IP Address</a></td></tr>";
$reports = $DB_site->query("SELECT u.userid, u.username, d.attachmentid, d.total, d.dateline, d.ipaddress, p.threadid, t.forumid
FROM user u
LEFT JOIN downloads d ON u.userid=d.userid
LEFT JOIN attachment AS a ON a.attachmentid=d.attachmentid
LEFT JOIN post AS p ON p.postid=a.postid
LEFT JOIN thread t ON p.threadid=t.threadid
WHERE t.forumid='$f' ORDER BY $orderby");
while ($report=$DB_site->fetch_array($reports))
{
echo "<tr>";
echo "<td align=\"left\"><a href=\"member.php?action=getinfo&userid=$report[userid]\" target=\"_blank\">".$report['username']."</a></td>";
//echo "<td align=\"center\">".$report['userid']."</td>";
echo "<td align=\"center\"><a href=\"showthread.php?threadid=$report[threadid]\" target=\"_blank\">".$report['attachmentid']."</a></td>";
echo "<td align=\"center\">".$report['total']."</td>";
echo "<td align=\"center\">".date("F j, Y, g:i a",$report['dateline'])."</td>";
echo "<td align=\"center\">".$report['ipaddress']."</td>";
echo "</tr>";
}
?>
</font>
</BODY>
</HTML>