function 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 '
Viewing '.$name['0'].'\'s Blog
'; for ($i = 0; $i < $rows; $i++) { $options=''; $post = mysql_fetch_assoc($result); if(usercheck($_SESSION['user_id']) == 1 || usercheck($_SESSION['user_id']) == 2) { $options ='Edit Post | Delete Post'; } elseif($_SESSION['user_id'] = $post['post_author']) { $options ='Edit Post | Delete Post'; } elseif(usercheck($_SESSION['user_id']) == 0){$options='';} ?>
Posted on

".usercheck($_SESSION['user_id'])."
".$options."
"; ?>
$MAXPOSTSPERPAGE) { echo ""; echo "Page: "; $inc = 0; for ($i=1; $pages > 0; $i++) { echo ""; if (($st >= $inc) && ($st < $inc+$MAXPOSTSPERPAGE)) { echo " ".$i." "; } else { echo $i." "; } echo ""; $inc+=$MAXPOSTSPERPAGE; $pages-=$MAXPOSTSPERPAGE; } echo ""; } echo '
'; break;