rendered paste bodyfunction usercheck($id){$str = "SELECT user_type FROM swat_cod4_tw_tlink WHERE user_id = {$id}";$qry = mysql_query($str) or die(mysql_error());$userrank = 3; if($qry) { while($row=mysql_fetch_assoc($qry)) { $userrank = $row['user_type']; } return $userrank; } else { $userrank = 3; return $userrank; }}case 'twblog':$teamidq = mysql_query("SELECT team_id FROM swat_cod4_tw_tlink WHERE user_id = ".$_SESSION['user_id']);while($row = mysql_fetch_row($teamidq)){$teamid = $row[0];}$MAXPOSTSPERPAGE = 4; $pageQuery = mysql_query("SELECT * FROM swat_cod4_tw_blog WHERE `post_team`={$teamid} ORDER BY `post_timestamp` DESC"); $rows = mysql_num_rows($pageQuery); if (!isset($_GET["st"])) { $st=0; } else { $st = (int)$_GET["st"]; if ($_GET["st"] < 0) { $st = 0; } } if ($st > $rows) { $st = $rows-1; } $result = mysql_query("SELECT a.*,b.user_name FROM swat_cod4_tw_blog a, swat_xbox_users b WHERE a.post_team={$teamid} AND a.post_author = b.user_id ORDER BY a.post_timestamp ASC LIMIT $st, $MAXPOSTSPERPAGE"); if ($rows - $st < $MAXPOSTSPERPAGE) {$rows = ($rows - $st) % $MAXPOSTSPERPAGE;} else {$rows = $MAXPOSTSPERPAGE;} $namestring = "SELECT team_name FROM swat_cod4_tw_teams WHERE team_id={$teamid} LIMIT 1"; $namequery = mysql_query($namestring); $name = mysql_fetch_row($namequery); echo '<table width ="466" cellspacing="2" cellpadding="0"><tr><td class="profile_header">Viewing '.$name['0'].'\'s Blog</td></tr><tr><td class="blog_content">'; for ($i = 0; $i < $rows; $i++) { $options=''; $post = mysql_fetch_assoc($result); if(usercheck($_SESSION['user_id']) == 1 || usercheck($_SESSION['user_id']) == 2) { $options ='<span class="headerlinks"><a href="?action=edittwpost">Edit Post</a> | <a href="?action=deletetwpost">Delete Post</a></span>'; } elseif($_SESSION['user_id'] = $post['post_author']) { $options ='<span class="headerlinks"><a href="?action=edittwpost">Edit Post</a> | <a href="?action=deletetwpost">Delete Post</a></span>'; } elseif(usercheck($_SESSION['user_id']) == 0){$options='';}?> <table width="100%" class="title_header"> <tr> <td align="left" valign="center"><?php echo $post['post_title']; //shows the title of a post ?></td> </tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="timestamp_header"> <tr> <td height="20" align="left" valign="middle">Posted on <?php echo date('l, F jS (g:i A)', $post['post_timestamp'])." by ".$post['user_name']; //shows date and time of post ?></td> </tr> </table> <table width="100%" class="event_description"> <tr> <td align="left" valign="top"><?php echo $post['post_content']."<br><br>".usercheck($_SESSION['user_id'])."<center>".$options."</center>"; ?></td> </tr> </table><? } $pages = mysql_num_rows($pageQuery); if ($pages > $MAXPOSTSPERPAGE) { echo "<span class='text12'>"; echo "Page: "; $inc = 0; for ($i=1; $pages > 0; $i++) { echo "<a href=\"?action=viewBlog&id={$_GET['id']}&st={$inc}\">"; if (($st >= $inc) && ($st < $inc+$MAXPOSTSPERPAGE)) { echo " <b>".$i." </b>"; } else { echo $i." "; } echo "</a>"; $inc+=$MAXPOSTSPERPAGE; $pages-=$MAXPOSTSPERPAGE; } echo "</span>"; } echo '</td></tr></table>'; break;