"._YOURSTATS.""; $penname = USERPENNAME; } else { $authquery = dbquery("SELECT "._PENNAMEFIELD." FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid'"); list($penname) = dbrow($authquery); $pagetitle = "
"._STATSFOR." ".$penname."
"; } $output = $pagetitle; $storyquery = dbquery("SELECT s.title, s.sid, s.rating, s.reviews, s.count, count(fs.item) as fscount FROM ".TABLEPREFIX."fanfiction_stories as s LEFT JOIN ".TABLEPREFIX."fanfiction_favorites as fs ON s.sid = fs.item AND fs.type = 'ST' LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors AS c ON s.sid = c.sid WHERE (s.uid = '$uid' OR c.uid = '$uid') AND s.validated > 0 GROUP BY s.sid"); $storycount = dbnumrows($storyquery); $thislink = basename($_SERVER['PHP_SELF']).(basename($_SERVER['PHP_SELF']) == "viewuser.php" ? "?uid=$uid&" : "?"); $authorof[] = "$storycount "._STORIES.""; if($stat == "stories" && dbnumrows($storyquery)) { $hidechapters = isset($_GET["chapters"]) ? $_GET["chapters"] : false; $output .= "

"._VIEWCHAPTERS : "hide\">"._HIDECHAPTERS)."

".($reviewsallowed ? "" : "").($favorites ? "" : "").""; while($story = dbassoc($storyquery)) { $output .= "". ($reviewsallowed ? "" : ""). ($favorites ? "" : "")." "; if($hidechapters && $hidechapters != "hide") { $query2 = dbquery("SELECT chapid, title, inorder, rating, reviews, validated, count FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$story['sid']."' ORDER BY inorder"); while($chapter = dbassoc($query2)) { $output .= "". ($reviewsallowed ? "" : ""). ($favorites ? "" : "")." "; } } } $output .= "
"._STORIES.""._REVIEWS.""._FAVORITE.""._READS."
".$story['title']." ".ratingpics($story['rating'])."".$story['reviews']."".($story['fscount'] ? "".$story['fscount']."" : $story['fscount'])."".(isset($story['count']) ? $story['count'] : 0 )."
     ".$chapter['title']." ".ratingpics($chapter['rating'])."".($chapter['reviews'] ? "".$chapter['reviews']."" : "0")." --- ".(isset($chapter['count']) ? $chapter['count'] : 0 )."
"; if(dbnumrows($storyquery) < 1) $output .= write_message(_NORESULTS); } $seriesquery = dbquery("SELECT s.title, s.seriesid, s.rating, s.reviews, count(fs.item) as count FROM ".TABLEPREFIX."fanfiction_series as s LEFT JOIN ".TABLEPREFIX."fanfiction_favorites as fs ON s.seriesid = fs.item AND fs.type = 'SE' WHERE s.uid = '$uid' GROUP BY s.seriesid"); $seriescount = dbnumrows($seriesquery); $authorof[] = "$seriescount "._SERIES.""; if($stat == "series" && dbnumrows($seriesquery)) { $output .= "

"._SERIES."

".($reviewsallowed ? "" : "").($favorites ? "" : "").""; while($series = dbassoc($seriesquery)) { $output .= "".($reviewsallowed ? "" : "").($favorites ? "" : "").""; $serieslist[] = $series['seriesid']; } $output .= "
"._TITLE.""._REVIEWS.""._FAVORITE."
".stripslashes($series['title'])." ".ratingpics($series['rating'])."$series[reviews]".($series['count'] ? "$series[count]" : "0")."
"; } $reviewquery = dbquery("SELECT count(reviewid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE uid = '$uid' AND review != 'No Review'"); list($reviewcount) = dbrow($reviewquery); $authorof[] = "$reviewcount "._REVIEWS.""; $aocode = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'AO'"); while($ao = dbassoc($aocode)) { eval($ao['code_text']); } if(empty($stat)) $output .= "
"._AUTHOROF." ". implode(", ", $authorof)."
"; if($favorites) { $favof = dbquery("SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_favorites WHERE item = '$uid' AND type = 'AU'"); list($favcount) = dbrow($favof); if(isset($_GET['favstor']) && isNumber($_GET['favstor'])) { $favstor = $_GET['favstor']; $squery = "SELECT title FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$favstor' LIMIT 1"; $story = dbquery($squery); list($title) = dbrow($story); $output = "
"._FAVORITE.": $title
"; $countquery = "SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_favorites WHERE type = 'ST' AND item = '$favstor'"; $authorquery = "SELECT ap.stories, "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_favorites as fav LEFT JOIN "._AUTHORTABLE." ON fav.uid = "._UIDFIELD." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON ap.uid = fav.uid WHERE fav.item = '$favstor' AND fav.type = 'ST' GROUP BY fav.uid"; $pagelink= $thislink."action=stats&favstor=$favstor".($offset > 0 ? "&offset=$offset" : "")."&"; include("includes/members_list.php"); } else if(isset($_GET['favseries']) && isNumber($_GET['favseries'])) { $favseries = $_GET['favseries']; $story = dbquery("SELECT title FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$favseries' LIMIT 1"); list($title) = dbrow($story); $output = "
"._FAVORITE.": $title
"; $countquery = "SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_favorites WHERE item = '$favseries' AND type = 'SE'"; $authorquery = "SELECT ap.stories,"._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_favorites as fav LEFT JOIN "._AUTHORTABLE." ON fav.uid = "._UIDFIELD." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON ap.uid = fav.uid WHERE fav.item = '$favseries' AND fav.type = 'SE' GROUP BY fav.uid"; $pagelink= $thislink."action=stats&favseries=$favseries".($offset > 0 ? "&offset=$offset" : "")."&"; include("includes/members_list.php"); } else if($stat == "favauthor") { $output = "
"._FAVORITE.": $penname
"; $countquery = "SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_favorites WHERE item = '$uid' AND type = 'AU'"; $authorquery = "SELECT ap.stories, "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_favorites AS fav LEFT JOIN "._AUTHORTABLE." ON fav.uid = "._UIDFIELD." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = fav.uid WHERE fav.item = '$uid' AND fav.type = 'AU' GROUP BY fav.uid"; $pagelink= $thislink."action=stats&stat=favauthor".($offset > 0 ? "&offset=$offset" : "")."&"; include("includes/members_list.php"); } $favlist = array( ); $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_type = 'F' AND panel_name != 'favlist' ORDER BY panel_title ASC"); if(!$panelquery) $output .= write_error(_ERROR); while($panel = dbassoc($panelquery)) { $panellink = ""; if(substr($panel['panel_name'], 0, 3) == "fav" && $type = substr($panel['panel_name'], 3)) { if($panel['panel_name'] == "favlist") continue; $itemcount = 0; $countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = '$type'"); list($itemcount) = dbrow($countquery); $favlist[] = "".(isset($itemcount) ? " $itemcount " : "").stripslashes($panel['panel_title']).""; } } if(empty($stat)) $output .= "
"._FAVOF.": $favcount "._MEMBERS."
".(USERUID == $uid ? _YOURFAVORITES : _FAVORITESOF." $penname").": ".implode(", ", $favlist)."
"; } ?>