resultq("SELECT MAX(`id`) FROM `posts`"); if ($_GET['t']) { $maxtime = (int)$_GET['t'] <= 86400 ? (int)$_GET['t'] : 86400; } else { $maxtime = 86400; } if ($_GET['p']) { $maxposts = (int)$_GET['p'] <= 100 ? (int)$_GET['p'] : 50; } else { $maxposts = 50; } $data = mysql_query("SELECT p.id, p.user,p.date as date, f.title as ftitle, t.forum as fid, t.title as title, ". "u.name as uname, u.sex as usex, u.powerlevel as upowerlevel ". "FROM `posts` p ". "LEFT JOIN `threads` t ON p.thread = t.id ". "LEFT JOIN `forums` f ON t.forum = f.id ". "LEFT JOIN `users` u ON p.user = u.id ". "\n WHERE f.minpower <= '". $loguser['powerlevel'] ."' ". "AND p.date >= ". (ctime()-$maxtime) .($_GET['lastid'] ? " AND p.id > ".$_GET['lastid']:"")." ". "\nORDER BY `id` DESC ". "LIMIT 0, $maxposts" # posts limit here ); $_count = mysql_num_rows($data); $output = ""; if ($_GET['raw']) { $outarray = array('id', 'ftitle', 'fid', 'title', 'uname', 'upowerlevel', 'usex', 'ucolor', 'date', 'user'); $outchunks = Array(); } require 'lib/layout.php'; $_counter = 1; while ($in = mysql_fetch_array($data, MYSQL_ASSOC)) { if (!$_GET['raw']) { $output .= " $tccell2>". $in['id'] ." $tccell2>". $in['ftitle'] ." $tccell1l>". $in['title'] ." $tccell1>". $in['uname'] ." $tccell2>". timeunits(ctime() - $in['date']) ." \n"; } else { $in['ucolor'] = str_replace('color=', '', getnamecolor($in['usex'], $in['upowerlevel'])); $in['title'] = str_replace("\\", "\\\\", $in['title']); $temp = Array(); foreach($outarray as $outkey) { $temp[] = ('"'.$outkey . "\":\"" . htmlspecialchars($in[$outkey]) . '"'); } $temp = "{".implode(",",$temp)."}".($_counter == $_count ? "" : ","); $output .= $temp; } $_counter++; } if (!$_GET['raw']) { if ($_GET['fungies']) { $jscripts = ''; } print " $header Show:$smallfont
Last 30 minutes - 1 hour - 5 hours - 1 day
Most recent 20 posts - 50 posts - 100 posts $tccellc colspan=6>Latest Posts $tccellh width=30>  $tccellh width=200>Forum $tccellh>Thread $tccellh width=200>User $tccellh width=130>Time $output ". $tblend . $jscripts . $footer; printtimedif($startingtime); } else { header("Content-type: text/plain"); header("Ajax-request: ".IS_AJAX_REQUEST); print '{"tzoff": "'.$tzoff.'", "localtime": "'.ctime().'", "posts": ['.$output."]}"; }