Browse code

$tableprefix replaced with TABLEPREFIX

Jimako authored on 2023/06/12 12:19:20
Showing 1 changed files
... ...
@@ -28,10 +28,10 @@ function featured( ) {
28 28
 	global $tableprefix;
29 29
 
30 30
 	if($_GET['retire'])
31
-		mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
31
+		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
32 32
 	if($_GET['feature'])
33
-		mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
-	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
33
+		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
+	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
35 35
 	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
36 36
 	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37 37
 	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
... ...
@@ -47,14 +47,14 @@ function submitted()
47 47
 {
48 48
 	global $tableprefix, $admincats, $allowed_tags;
49 49
 		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
50
-		$query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".$tableprefix."fanfiction_chapters as chapter, ".$tableprefix."fanfiction_authors as author) LEFT JOIN ".$tableprefix."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC";
50
+		$query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author) LEFT JOIN ".TABLEPREFIX."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC";
51 51
 		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
52 52
 		$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>";
53 53
 		$array = explode(",", $admincats);
54 54
 		while ($story = mysql_fetch_assoc($result))
55 55
 		{
56 56
 			unset($catstring);
57
-			$result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
57
+			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58 58
 			while($cats = mysql_fetch_array($result3)) {
59 59
 				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
60 60
 			}
... ...
@@ -78,12 +78,12 @@ function validate( ) {
78 78
 
79 79
 	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
80 80
 	if($_GET['validate'] == "yes") {
81
-		$storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters  as chapter, ".$tableprefix."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
81
+		$storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters  as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
82 82
 		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
83 83
 		if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) {
84 84
 			include("includes/emailer.php");
85 85
 			if($validated != "1") {
86
-				mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'");
86
+				mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'");
87 87
 				$categories = explode(",", $catid);
88 88
 				include("functions.php");
89 89
 				foreach($categories as $cat) {
... ...
@@ -92,7 +92,7 @@ function validate( ) {
92 92
 				if($alertson) {
93 93
 					$subject = _NEWSTORYAT;
94 94
 					$mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid);
95
-					$favorites = mysql_query("SELECT author.uid, email, penname FROM ".$tableprefix."fanfiction_favauth as fav, ".$tableprefix."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
95
+					$favorites = mysql_query("SELECT author.uid, email, penname FROM ".TABLEPREFIX."fanfiction_favauth as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
96 96
 					while($favuser = mysql_fetch_array($favorites)) { 
97 97
 						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
98 98
 					}				
... ...
@@ -101,25 +101,25 @@ function validate( ) {
101 101
 			else if($alertson) {
102 102
 				$subject = _STORYALERT;
103 103
 				$mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder);
104
-				$favorites = mysql_query("SELECT author.uid, penname, email FROM ".$tableprefix."fanfiction_favstor as fav, ".$tableprefix."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
104
+				$favorites = mysql_query("SELECT author.uid, penname, email FROM ".TABLEPREFIX."fanfiction_favstor as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
105 105
 				while($favuser = mysql_fetch_array($favorites)) { 
106 106
 					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
107 107
 				}
108 108
 			}
109
-			mysql_query("UPDATE ".$tableprefix."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
-			mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
109
+			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
+			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
111 111
 			$output .= "<center><b>"._STORYVALIDATED."</b></center>";
112 112
 		}
113 113
 		else
114 114
 			$output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN."  "._TRYAGAIN."</center><br /><br />";
115 115
 	}
116 116
 	else {
117
-			$result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
117
+			$result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
118 118
 			$story = mysql_fetch_array($result);
119 119
 			$output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />";
120 120
 			$output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title'];
121 121
 			$output .= "<br />";
122
-			$result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
122
+			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
123 123
 			$catstring = "";
124 124
 			$count = 0;
125 125
 			while($cats = mysql_fetch_array($result3)) {
... ...
@@ -155,7 +155,7 @@ function validate( ) {
155 155
 				$storytext .= $story['storytext'];
156 156
 			}
157 157
 			if(strpos($story, "<br>") === false && strpos($story, "<p>") === false && strpos($story, "<br />") === false) $storytext = nl2br($storytext);
158
-			$storytext = format_story($storytext, $allowed_tags));
158
+			$storytext = format_story($storytext, $allowed_tags);
159 159
 			$output .= $storytext;
160 160
 			$output .= "<br /><br />";
161 161
 			$output .= "<a href=\"admin.php?action=validate&amp;sid=".$story['sid']."&amp;chapid=".$story['chapid']."&amp;validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editchapter&amp;chapid=".$story['chapid']."&amp;admin=1\">"._EDIT." - "._CHAPTER."</a> | <a href=\"stories.php?action=delete&amp;chapid=".$story['chapid']."&amp;sid=".$story['sid']."&amp;admin=1&amp;uid=".$story['uid']."\">"._DELETE." - "._CHAPTER."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&amp;uid=".$story['uid']."&amp;chapid=".$story['chapid']."',400, 300, 'yes')\">"._NOLETTER."</a><br />";
... ...
@@ -183,9 +183,9 @@ function yesletter( ) {
183 183
 		else echo "<div style='text-align: center;'>"._ERROR."</div>";
184 184
 	}
185 185
 	else {
186
-			$authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
186
+			$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187 187
 			$author = mysql_fetch_array($authorquery);
188
-			$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
188
+			$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
189 189
 			$story = mysql_fetch_array($storyquery);
190 190
 			$letter = file_get_contents("messages/thankyou.txt");
191 191
 			echo "<body>";
... ...
@@ -220,9 +220,9 @@ function noletter( ) {
220 220
 	}
221 221
 	else
222 222
 	{
223
-		$authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
223
+		$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224 224
 		$author = mysql_fetch_array($authorquery);
225
-		$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
225
+		$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
226 226
 		$story = mysql_fetch_array($storyquery);
227 227
 		$letter = file_get_contents("messages/nothankyou.txt");
228 228
 		echo "<body>";