resultq("SELECT name FROM users WHERE id=$id"); $windowtitle = "Listing posts by $user"; require 'lib/layout.php'; if (!$id) errorpage('No user specified.', 'return to the board', 'index.php'); if ($_GET['forum']) { $fid = intval($_GET['forum']); $forum = $sql->fetchq("SELECT title, minpower FROM forums WHERE id={$fid}"); if ($forum['minpower'] > 0 && $power < $forum['minpower']) errorpage('You don\'t have access to view posts in this forum.', 'return to the board', 'index.php'); $where = "in $forum[title]"; $forumquery = " AND t.forum = {$fid}"; } else { $forumquery = ''; $where = "on the board"; } if ($_GET['time']) { $time = intval($_GET['time']); $when = " over the past ".timeunits2($time); $timequery = ' AND p.date > ' . (ctime()-$time); } else $timequery = $when = ''; if (!$page) $page=0; if (!$ppp) $ppp=50; $min = $ppp*$page; $posts=$sql->query("SELECT p.id,thread,ip,date,num,t.title,minpower " ."FROM posts p " ."LEFT JOIN threads t ON (thread=t.id) " ."LEFT JOIN forums f ON (t.forum=f.id) " ."WHERE p.user={$id}{$forumquery}{$timequery} ORDER BY p.id DESC"); $posttotal=mysql_num_rows($posts); // Seek to page if (!@mysql_data_seek($posts, $min)) $page = 0; $pagelinks=$smallfont.'Pages:'; for($i=0;$i<($posttotal/$ppp);$i++) { if($i==$page) $pagelinks.=' '.($i+1); else { if($ppp != 50) $postperpage = "&ppp=$ppp"; if($forumquery) $forumlink = '&forum='.intval($_GET['forum']); $pagelinks.=" ".($i+1).''; } } $postlist=" $tccellhs width=50># $tccellhs width=50>Post $tccellhs width=130>Date $tccellhs>Thread " . (($isadmin) ? "$tccellhs width=110>IP address" : ""); while(($post = $sql->fetch($posts)) && $ppp--) { if($post['minpower']<=$power or !$post['minpower']) $threadlink="".str_replace('<','<',$post['title']).''; else $threadlink='(restricted)'; if(!$post['num']) $post['num']='?'; $postlist.=" $tccell1s>$post[0] $tccell1s>$post[num] $tccell1s>".date($dateformat,$post[3]+$tzoff)." $tccell1ls>#$post[1] - $threadlink " . (($isadmin) ? "$tccell1s>$post[2]" : "") ." "; } print "{$header}{$fonttag}Posts by {$user} {$where}{$when}: ({$posttotal} posts found) $tblstart$postlist$tblend$pagelinks$footer"; printtimedif($startingtime); ?>