| ... | ... |
@@ -26,6 +26,8 @@ if(isset($_GET['action']) && ($_GET['action'] == "categories" || $_GET['action'] |
| 26 | 26 |
|
| 27 | 27 |
$disableTiny = true; |
| 28 | 28 |
|
| 29 |
+ob_start(); |
|
| 30 |
+ |
|
| 29 | 31 |
include ("header.php");
|
| 30 | 32 |
|
| 31 | 33 |
|
| ... | ... |
@@ -56,7 +58,7 @@ else include_once("languages/en_admin.php");
|
| 56 | 58 |
} |
| 57 | 59 |
$output .= "</div>\n"; |
| 58 | 60 |
if($action) {
|
| 59 |
- $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '$action' AND panel_type = 'A' LIMIT 1");
|
|
| 61 |
+ $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '".escapestring($action)."' AND panel_type = 'A' LIMIT 1");
|
|
| 60 | 62 |
if(dbnumrows($panelquery)) {
|
| 61 | 63 |
$panel = dbassoc($panelquery); |
| 62 | 64 |
if((isset($panel['panel_level']) ? $panel['panel_level'] : 0) >= uLEVEL) {
|
| ... | ... |
@@ -88,4 +90,4 @@ else include_once("languages/en_admin.php");
|
| 88 | 90 |
$tpl->assign( "output", $output ); |
| 89 | 91 |
$tpl->printToScreen(); |
| 90 | 92 |
dbclose( ); |
| 91 |
-?> |
|
| 92 | 93 |
\ No newline at end of file |
| 94 |
+?> |
| ... | ... |
@@ -41,7 +41,7 @@ if($type) {
|
| 41 | 41 |
$countquery = array(); |
| 42 | 42 |
$scountquery = array(); |
| 43 | 43 |
$searchtype = (isset($_REQUEST['searchtype']) ? $_REQUEST['searchtype'] : "simple"); |
| 44 |
- $searchterm = (isset($_REQUEST['searchterm']) ? descript($_REQUEST['searchterm']) : false); |
|
| 44 |
+ $searchterm = (isset($_REQUEST['searchterm']) ? escapestring(descript($_REQUEST['searchterm'])) : false); |
|
| 45 | 45 |
$disablesorts = array( ); |
| 46 | 46 |
if($searchterm) {
|
| 47 | 47 |
if($searchtype == "title") {
|
| ... | ... |
@@ -112,6 +112,7 @@ if($type) {
|
| 112 | 112 |
} |
| 113 | 113 |
if(!empty($_REQUEST['charlist1']) && !in_array($_REQUEST['charlist1'], $charid)) $charid[] = $_REQUEST['charlist1']; |
| 114 | 114 |
if(!empty($_REQUEST['charlist2']) && !in_array($_REQUEST['charlist2'], $charid)) $charid[] = $_REQUEST['charlist2']; |
| 115 |
+ $charid = array_filter($charid, "isNumber"); |
|
| 115 | 116 |
if($charid) {
|
| 116 | 117 |
foreach($charid as $c) {
|
| 117 | 118 |
if(!empty($c)) {
|
| ... | ... |
@@ -126,9 +127,9 @@ if($type) {
|
| 126 | 127 |
if(count($charseries) > 0) $scountquery[] = "(".implode(" AND ", $charseries).")";
|
| 127 | 128 |
} |
| 128 | 129 |
$rid = array( ); $rating = array( ); |
| 129 |
- if(!empty($_REQUEST['rid'])) $rid = is_array($_REQUEST['rid']) ? implode(",", $_REQUEST['rid']) : array($_REQUEST['rid']);
|
|
| 130 |
- if(!empty($_REQUEST['rating'])) $rating = is_array($_REQUEST['rating']) ? implode(",", $_REQUEST['rating']) : array($_REQUEST['rating']);
|
|
| 131 |
- $rid = array_merge($rid, $rating); |
|
| 130 |
+ if(!empty($_REQUEST['rid'])) $rid = is_array($_REQUEST['rid']) ? $_REQUEST['rid'] : explode(",", $_REQUEST['rid']);
|
|
| 131 |
+ if(!empty($_REQUEST['rating'])) $rating = is_array($_REQUEST['rating']) ? $_REQUEST['rating'] : explode(",", $_REQUEST['rating']);
|
|
| 132 |
+ $rid = array_filter(array_merge($rid, $rating), "isNumber"); |
|
| 132 | 133 |
if(!empty($rid)) {
|
| 133 | 134 |
$query[] = "FIND_IN_SET(stories.rid, '".(implode(",", $rid))."') > 0";
|
| 134 | 135 |
$countquery[] = "FIND_IN_SET(stories.rid, '".(implode(",", $rid))."') > 0";
|
| ... | ... |
@@ -185,8 +186,8 @@ if($type) {
|
| 185 | 186 |
} |
| 186 | 187 |
// Begin story length |
| 187 | 188 |
unset($wordcount); |
| 188 |
- $wordlow = isset($_REQUEST['wordlow']) ? $_REQUEST['wordlow'] : "-500"; |
|
| 189 |
- $wordhigh = isset($_REQUEST['wordhigh']) ? $_REQUEST['wordhigh'] : "1000000"; |
|
| 189 |
+ $wordlow = isset($_REQUEST['wordlow']) && isNumber($_REQUEST['wordlow']) ? $_REQUEST['wordlow'] : "-500"; |
|
| 190 |
+ $wordhigh = isset($_REQUEST['wordhigh']) && isNumber($_REQUEST['wordhigh']) ? $_REQUEST['wordhigh'] : "1000000"; |
|
| 190 | 191 |
if($wordlow != "-500") $wordcount = "stories.wordcount > ".$wordlow; |
| 191 | 192 |
if($wordhigh != "1000000") |
| 192 | 193 |
{
|
| ... | ... |
@@ -210,11 +211,11 @@ if($type) {
|
| 210 | 211 |
$termsList = array(); |
| 211 | 212 |
foreach($termArray as $term => $value) {
|
| 212 | 213 |
if($term == "submit" || $term == "go" || $term == "offset" || $term == "type" || ($term != "complete" && empty($value))) continue; |
| 213 |
- $termsList[$term] = "$term=".(is_array($value) ? implode(",", $value) : $value);
|
|
| 214 |
+ $termsList[$term] = "$term=".(is_array($value) ? implode(",", array_map('htmlspecialchars', $value)) : htmlspecialchars($value, ENT_QUOTES));
|
|
| 214 | 215 |
} |
| 215 | 216 |
$terms = "type=$type".(count($termsList) ? "&" : "").implode("&", $termsList);
|
| 216 | 217 |
// End query strings |
| 217 |
- $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '$type' AND panel_type = 'B' LIMIT 1");
|
|
| 218 |
+ $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '".escapestring($type)."' AND panel_type = 'B' LIMIT 1");
|
|
| 218 | 219 |
if(dbnumrows($panelquery)) {
|
| 219 | 220 |
$numrows = 0; |
| 220 | 221 |
$panel = dbassoc($panelquery); |
| ... | ... |
@@ -25,7 +25,7 @@ |
| 25 | 25 |
if(!defined("_CHARSET")) exit( );
|
| 26 | 26 |
// Get session variables from cookie data if not logged in. |
| 27 | 27 |
// To bridge to another program replace (or add to) this information with the bridge to your other script. See examples in the includes/bridges/ folder. |
| 28 |
-if (!empty($_COOKIE[$sitekey."_useruid"])) {
|
|
| 28 |
+if (!empty($_COOKIE[$sitekey."_useruid"]) && isNumber($_COOKIE[$sitekey."_useruid"])) {
|
|
| 29 | 29 |
$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_COOKIE[$sitekey."_useruid"]."'"));
|
| 30 | 30 |
if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
|
| 31 | 31 |
define("USERUID", $userdata['uid']);
|
| ... | ... |
@@ -66,4 +66,4 @@ if(!defined("isMEMBER")) define("isMEMBER", false);
|
| 66 | 66 |
if(!defined("isADMIN")) define("isADMIN", false);
|
| 67 | 67 |
if(empty($siteskin)) $siteskin = $defaultskin; |
| 68 | 68 |
|
| 69 |
-?> |
|
| 70 | 69 |
\ No newline at end of file |
| 70 |
+?> |
| ... | ... |
@@ -56,7 +56,7 @@ if((empty($action) || $action == "login") && isMEMBER) {
|
| 56 | 56 |
$output .= "</div>\n"; |
| 57 | 57 |
} |
| 58 | 58 |
else if(!empty($action)) {
|
| 59 |
- $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '$action' AND (panel_type='U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") LIMIT 1");
|
|
| 59 |
+ $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = '".escapestring($action)."' AND (panel_type='U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") LIMIT 1");
|
|
| 60 | 60 |
if(dbnumrows($panelquery)) {
|
| 61 | 61 |
$panel = dbassoc($panelquery); |
| 62 | 62 |
if($panel['panel_level'] > 0 && !isMEMBER) accessDenied( ); |
| ... | ... |
@@ -70,4 +70,4 @@ else $output = write_error(_NOTAUTHORIZED); |
| 70 | 70 |
$tpl->assign( "output", $output ); |
| 71 | 71 |
$tpl->printToScreen(); |
| 72 | 72 |
dbclose( ); |
| 73 |
-?> |
|
| 74 | 73 |
\ No newline at end of file |
| 74 |
+?> |