| ... | ... |
@@ -145,6 +145,8 @@ else if($action == "edit" || $action == "add") {
|
| 145 | 145 |
else {
|
| 146 | 146 |
$output .= write_message(_REVTHANKYOU); |
| 147 | 147 |
if($action == "edit") {
|
| 148 |
+ list($revuid) = dbrow(dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_reviews WHERE reviewid = '$reviewid' LIMIT 1"));
|
|
| 149 |
+ if(!isADMIN && (int)$revuid !== (int)USERUID) accessDenied( ); |
|
| 148 | 150 |
$update = dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET review = '$review', rating = '$rating' WHERE reviewid = '$reviewid' LIMIT 1");
|
| 149 | 151 |
$info = dbquery("SELECT item, type, chapid FROM ".TABLEPREFIX."fanfiction_reviews WHERE reviewid = '$reviewid' LIMIT 1");
|
| 150 | 152 |
list($item, $type, $chapid) = dbrow($info); |
| ... | ... |
@@ -113,7 +113,10 @@ if($add == "series" || ($action == "add" && !$add) || $action == "edit") {
|
| 113 | 113 |
$title = replace_naughty($title); |
| 114 | 114 |
$summary = replace_naughty($summary); |
| 115 | 115 |
if($action == "edit") {
|
| 116 |
+ if(!isset($_POST['seriesid']) || !isNumber($_POST['seriesid'])) accessDenied( ); |
|
| 116 | 117 |
$seriesid = $_POST['seriesid']; |
| 118 |
+ list($seriesowner) = dbrow(dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$seriesid' LIMIT 1"));
|
|
| 119 |
+ if(!$admin && $seriesowner != USERUID) accessDenied( ); |
|
| 117 | 120 |
dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET title = '$title', summary ='$summary', catid = '$category', isopen = '$open', characters = '$charid', classes = '$classes' WHERE seriesid = '$seriesid'");
|
| 118 | 121 |
$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'editseries'");
|
| 119 | 122 |
while($code = dbassoc($codequery)) {
|
| ... | ... |
@@ -46,7 +46,8 @@ function random_string ($charset_string, $length) |
| 46 | 46 |
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false; |
| 47 | 47 |
if(!$uid) $uid = USERUID; |
| 48 | 48 |
|
| 49 |
- if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") $output .= write_error(_NOTAUTHORIZED); |
|
| 49 |
+ if($uid && !isNumber($uid)) accessDenied( ); |
|
| 50 |
+ if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") accessDenied( ); |
|
| 50 | 51 |
if(isMEMBER) $output .= "<div id=\"pagetitle\">"._EDITPERSONAL."</div>"; |
| 51 | 52 |
else $output .= "<div id=\"pagetitle\">"._NEWACCOUNT."</div>"; |
| 52 | 53 |
if(!empty($_POST['submit'])) {
|
| ... | ... |
@@ -164,7 +165,7 @@ function random_string ($charset_string, $length) |
| 164 | 165 |
$output .= write_message(_PENNAMEINUSE." "._TRYAGAIN); |
| 165 | 166 |
} |
| 166 | 167 |
else {
|
| 167 |
- dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$_POST[uid]'");
|
|
| 168 |
+ dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$uid'");
|
|
| 168 | 169 |
if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST['oldpenname'], $uid, $penname))."', '".USERUID."', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB', " . time() . ")");
|
| 169 | 170 |
} |
| 170 | 171 |
} |
| ... | ... |
@@ -207,8 +208,8 @@ function random_string ($charset_string, $length) |
| 207 | 208 |
else if(isset($user)) $output .= " ".$user['penname']; |
| 208 | 209 |
|
| 209 | 210 |
$output .= "</div> |
| 210 |
- <div><label for='realname'>"._REALNAME.": </label><INPUT type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".(isset($user) ? $user['realname'] : "")."\"></div> |
|
| 211 |
- <div><label for='email'>"._EMAIL.":</label><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".(isset($user) ? $user['email'] : "")."\" maxlength=\"200\" size=\"35\"><font color=\"red\">*</font></div> |
|
| 211 |
+ <div><label for='realname'>"._REALNAME.": </label><INPUT type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".(isset($user) ? htmlspecialchars($user['realname'], ENT_QUOTES) : "")."\"></div> |
|
| 212 |
+ <div><label for='email'>"._EMAIL.":</label><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".(isset($user) ? htmlspecialchars($user['email'], ENT_QUOTES) : "")."\" maxlength=\"200\" size=\"35\"><font color=\"red\">*</font></div> |
|
| 212 | 213 |
<div><label for='bio'>"._BIO.":</label></div> |
| 213 | 214 |
<div style='width: 450px; margin: 0 auto;'> |
| 214 | 215 |
<textarea class=\"textbox\" name=\"bio\" cols=\"50\" rows=\"6\">".(isset($user['bio']) ? stripslashes($user['bio']) : "")."</TEXTAREA></div>"; |
| ... | ... |
@@ -70,6 +70,7 @@ |
| 70 | 70 |
setcookie($sitekey."_salt", md5($passwd['email'] . $encryptedpassword), time()+60*60*24*30, "/"); |
| 71 | 71 |
} |
| 72 | 72 |
if(!isset($_SESSION)) session_start( ); |
| 73 |
+ session_regenerate_id(true); |
|
| 73 | 74 |
$_SESSION[$sitekey."_useruid"] = $passwd['uid']; |
| 74 | 75 |
$_SESSION[$sitekey."_salt"] = md5($passwd['email'] . $encryptedpassword); |
| 75 | 76 |
$logincode = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'login'");
|
| ... | ... |
@@ -46,7 +46,7 @@ if(isset($userinfo['bio'])) {
|
| 46 | 46 |
$tpl->assign("bio", stripslashes($bio));
|
| 47 | 47 |
} |
| 48 | 48 |
if(isset($userinfo['image'])) |
| 49 |
- $tpl->assign("image", "<img src=\"".$userinfo['image']."\">");
|
|
| 49 |
+ $tpl->assign("image", "<img src=\"".htmlspecialchars($userinfo['image'], ENT_QUOTES)."\">");
|
|
| 50 | 50 |
|
| 51 | 51 |
$tpl->assign("userlevel", isset($userinfo['level']) && $userinfo['level'] > 0 && $userinfo['level'] < 4 ? _ADMINISTRATOR.(isADMIN ? " - ".$userinfo['level'] : "") : _MEMBER);
|
| 52 | 52 |
|
| ... | ... |
@@ -26,10 +26,11 @@ if(!defined("_CHARSET")) exit( );
|
| 26 | 26 |
|
| 27 | 27 |
$output .= "<div id=\"pagetitle\">"._MANAGEREVIEWS."</div>"; |
| 28 | 28 |
if(isset($_POST['submit'])) {
|
| 29 |
- $reviewid = isset($_POST['reviewid']) && isNumber($_POST['reviewid']) ? $_POST['reviewid'] : false; |
|
| 30 |
- $result = dbquery("SELECT review, reviewid, item, type, chapid, uid FROM ".TABLEPREFIX."fanfiction_reviews WHERE reviewid = '".$_POST['rid']."' LIMIT 1");
|
|
| 29 |
+ $reviewid = isset($_POST['rid']) && isNumber($_POST['rid']) ? $_POST['rid'] : false; |
|
| 30 |
+ if(!$reviewid) accessDenied( ); |
|
| 31 |
+ $result = dbquery("SELECT review, reviewid, item, type, chapid, uid FROM ".TABLEPREFIX."fanfiction_reviews WHERE reviewid = '$reviewid' LIMIT 1");
|
|
| 31 | 32 |
list($review, $reviewid, $item, $type, $chapid, $uid) = dbrow($result); |
| 32 |
- $updated = escapestring($review . "<br><br><i>"._AUTHORSRESPONSE.": " .replace_naughty(descript($_POST['response'], $allowed_tags))."</i>"); |
|
| 33 |
+ $updated = escapestring($review . "<br><br><i>"._AUTHORSRESPONSE.": " .replace_naughty(descript(strip_tags($_POST['response'], $allowed_tags)))."</i>"); |
|
| 33 | 34 |
$success = dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET review = '$updated', respond = '1' WHERE reviewid = '$reviewid'");
|
| 34 | 35 |
if($uid) {
|
| 35 | 36 |
$prefsquery = dbquery("SELECT "._UIDFIELD." as uid, "._EMAILFIELD." as email, "._PENNAMEFIELD." as penname, newrespond FROM ".TABLEPREFIX."fanfiction_authorprefs as ap LEFT JOIN "._AUTHORTABLE." ON ap.uid = "._UIDFIELD." WHERE ap.uid = "._UIDFIELD." AND "._UIDFIELD." = '$uid' LIMIT 1");
|
| ... | ... |
@@ -226,7 +226,7 @@ else if(($displayindex && empty($chapter)) || !empty($_GET['index'])) {
|
| 226 | 226 |
eval($code['code_text']); |
| 227 | 227 |
} |
| 228 | 228 |
include("includes/storyblock.php");
|
| 229 |
- $printicon = "<a href=\"viewstory.php?action=printable&textsize=$textsize&sid=$sid&chapter=all\" target=\"_blank\"><img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'></a>"; |
|
| 229 |
+ $printicon = "<img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'> <a href=\"viewstory.php?action=printable&textsize=$textsize&sid=$sid&chapter=all\" target=\"_blank\">"._STORY."</a>"; |
|
| 230 | 230 |
if($reviewsallowed && (isMEMBER || $anonreviews)) |
| 231 | 231 |
$reviewslink = "<a href=\"reviews.php?action=add&item=$sid&next=2&type=ST\">"._SUBMITREVIEW."</a>"; |
| 232 | 232 |
$tpl->assign( "reviewslink", $reviewslink ); |
| ... | ... |
@@ -248,7 +248,7 @@ else if(($displayindex && empty($chapter)) || !empty($_GET['index'])) {
|
| 248 | 248 |
$tpl->assign("chapternumber", $chap['inorder']);
|
| 249 | 249 |
$tpl->assign("title", "<a href=\"viewstory.php?sid=$sid&chapter=".$chap['inorder']."\">".$chap['title']."</a>");
|
| 250 | 250 |
$tpl->assign("author", "<a href='viewuser.php?uid=".$chap['uid']."'>".$chap['penname']."</a>");
|
| 251 |
- $tpl->assign("printicon", "<a href=\"viewstory.php?action=printable&textsize=$textsize&sid=$sid&chapter=".$chap['inorder']."\" target=\"_blank\"><img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'></a>");
|
|
| 251 |
+ $tpl->assign("printicon", "<img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'> <a href=\"viewstory.php?action=printable&textsize=$textsize&sid=$sid&chapter=".$chap['inorder']."\" target=\"_blank\">"._STORY."</a>");
|
|
| 252 | 252 |
$tpl->assign("ratingpics", ratingpics($chap['rating']));
|
| 253 | 253 |
if($reviewsallowed) {
|
| 254 | 254 |
$tpl->assign("reviews", "<a href=\"reviews.php?type=ST&item=$sid&chapid=".$chap['chapid']."\">"._REVIEWS."</a>");
|
| ... | ... |
@@ -343,7 +343,7 @@ else {
|
| 343 | 343 |
while($code = dbassoc($codeblocks)) {
|
| 344 | 344 |
eval($code['code_text']); |
| 345 | 345 |
} |
| 346 |
- $printicon = "<a href=\"viewstory.php?action=printable&sid=$sid&textsize=$textsize&chapter=1\" target=\"_blank\"><img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'></a>"; |
|
| 346 |
+ $printicon = "<img src='".(isset($printer) ? $printer : "images/print.gif")."' border='0' alt='"._PRINTER."'> <a href=\"viewstory.php?action=printable&sid=$sid&textsize=$textsize&chapter=1\" target=\"_blank\">"._STORY."</a>"; |
|
| 347 | 347 |
} |
| 348 | 348 |
// if the *CHAPTER* hasn't been validated and the viewer isn't an admin or the author throw them a warning. |
| 349 | 349 |
if(!$valid && !isADMIN && USERUID != $chapterauthor && !in_array($chapterauthor, $storyinfo['coauthors'])) {
|