Browse code

removed mysql functions

Jimako authored on 2023/09/06 06:29:19
Showing 8 changed files
... ...
@@ -25,17 +25,17 @@
25 25
 
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 function featured( ) {
28
-	global $tableprefix;
28
+	global $tableprefix, $dbconnect;
29 29
 
30 30
 	if($_GET['retire'])
31
-		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
31
+		dbquery("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']);
33
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34 34
 	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(FROM_UNIXTIME(stories.updated), '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(FROM_UNIXTIME(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
-	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
36
-	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
-	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
-	while($story = mysql_fetch_array($fresult)) {
35
+	$fresult = dbquery($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
36
+	$output = "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
+	if(!dbnumrows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
+	while($story = dbassoc($fresult)) {
39 39
 		$output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>";
40 40
 	}
41 41
 	$output .= "</table>"._FEATUREDNOTE;
... ...
@@ -45,17 +45,17 @@ function featured( ) {
45 45
 
46 46
 function submitted()
47 47
 {
48
-	global $tableprefix, $admincats, $allowed_tags;
49
-		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
48
+	global $tableprefix, $admincats, $allowed_tags, $dbconnect;
49
+		$output = "<center><h4>"._SUBMITTED."</h4></center>";
50 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
-		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
51
+		$result = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->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
-		while ($story = mysql_fetch_assoc($result))
54
+		while ($story = dbassoc($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']."')");
58
-			while($cats = mysql_fetch_array($result3)) {
57
+			$result3 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58
+			while($cats = dbassoc($result3)) {
59 59
 				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
60 60
 			}
61 61
 			if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) {
... ...
@@ -76,14 +76,14 @@ function submitted()
76 76
 function validate( ) {
77 77
 	global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson;
78 78
 
79
-	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
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");
82
-		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
81
+		$storyquery = dbquery("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
+		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = dbassoc($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 = '".time()."' WHERE sid = '".$_GET['sid']."'");
86
+				dbquery("UPDATE ".TABLEPREFIX. "fanfiction_stories SET validated = '1', updated = '".time()."' WHERE sid = '".$_GET['sid']."'");
87 87
 				$categories = explode(",", $catid);
88 88
 				include("functions.php");
89 89
 				foreach($categories as $cat) {
... ...
@@ -92,8 +92,8 @@ 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");
96
-					while($favuser = mysql_fetch_array($favorites)) { 
95
+					$favorites = dbquery("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
+					while($favuser = dbassoc($favorites)) { 
97 97
 						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
98 98
 					}				
99 99
 				}
... ...
@@ -101,28 +101,28 @@ 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");
105
-				while($favuser = mysql_fetch_array($favorites)) { 
104
+				$favorites = dbquery("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
+				while($favuser = dbassoc($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 = '" . time() . "' WHERE sid = '$sid'");
109
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' 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");
118
-			$story = mysql_fetch_array($result);
117
+			$result = dbquery("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
+			$story = dbassoc($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 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
123 123
 			$catstring = "";
124 124
 			$count = 0;
125
-			while($cats = mysql_fetch_array($result3)) {
125
+			while($cats = dbassoc($result3)) {
126 126
 				if($count > 0) $catstring .= ", ";
127 127
 				$catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
128 128
 				$categories[] = $cats['catid'];
... ...
@@ -183,10 +183,10 @@ 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");
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");
189
-			$story = mysql_fetch_array($storyquery);
186
+			$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187
+			$author = dbassoc($authorquery);
188
+			$storyquery = dbquery("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
+			$story = dbassoc($storyquery);
190 190
 			$letter = file_get_contents("messages/thankyou.txt");
191 191
 			echo "<body>";
192 192
 			echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
... ...
@@ -220,10 +220,10 @@ 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");
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");
226
-		$story = mysql_fetch_array($storyquery);
223
+		$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224
+		$author = dbassoc($authorquery);
225
+		$storyquery = dbquery("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
+		$story = dbassoc($storyquery);
227 227
 		$letter = file_get_contents("messages/nothankyou.txt");
228 228
 		echo "<body>";
229 229
 		echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
... ...
@@ -26,9 +26,9 @@
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 
28 28
 function warnings( ) {
29
-	global $allowed_tags;
29
+	global $allowed_tags, $dbconnect;
30 30
 
31
-	$output .= "<center><h4>"._WARNINGS."</h4></center>";
31
+	$output = "<center><h4>"._WARNINGS."</h4></center>";
32 32
 	if($_GET["delete"]) {
33 33
 		$wid = $_GET["delete"];
34 34
 		if($_GET["confirm"] == "yes")
... ...
@@ -68,14 +68,14 @@ function warnings( ) {
68 68
 		}
69 69
 	}
70 70
 	if ($_POST['submit']) {
71
-		if($_GET['warning'] == "new") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(stripinput(strip_tags($_POST['warning'])))."')") or die(_FATALERROR."Query: INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(strip_tags($_POST['warning']))."')<br />Error: (".mysql_errno( ).") ".mysql_error( ));
72
-		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(stripinput(strip_tags($_POST['warning'])))."' WHERE wid = '".$_GET['warning']."'") or die(_FATALERROR."Query: UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(strip_tags($_POST['warnings']))."' WHERE wid = '".$_GET['warning']."'<br />Error: (".mysql_errno( ).") ".mysql_error( ));
71
+		if($_GET['warning'] == "new") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(stripinput(strip_tags($_POST['warning'])))."')") or die(_FATALERROR."Query: INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(strip_tags($_POST['warning']))."')<br />Error: (". $dbconnect->errno.") ".$dbconnect->error);
72
+		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(stripinput(strip_tags($_POST['warning'])))."' WHERE wid = '".$_GET['warning']."'") or die(_FATALERROR."Query: UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(strip_tags($_POST['warnings']))."' WHERE wid = '".$_GET['warning']."'<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
73 73
 			$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
74 74
 	}
75 75
 	else {
76 76
 		if(isset($_GET['warning'])) {
77 77
 			if($_GET['warning'] != "new") {
78
-				$warnquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1") or die(_FATALERROR."Query: SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1<br />Error: (".mysql_errno( ).") ".mysql_error( ));
78
+				$warnquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1") or die(_FATALERROR."Query: SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
79 79
 				$warning = dbassoc($warnquery);
80 80
 			}
81 81
 			$output .=  "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=warnings&warning=".$_GET['warning']."\">
... ...
@@ -30,7 +30,7 @@ if(!defined("_CHARSET")) exit( );
30 30
 	if($multiplecats) {
31 31
 		$displaycolumns = $displaycolumns ? $displaycolumns : 1;
32 32
 		$query = "SELECT * FROM ".TABLEPREFIX."fanfiction_categories WHERE parentcatid = '-1' ORDER BY displayorder";
33
-		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
33
+		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
34 34
 		$total = dbnumrows($result4);
35 35
 		$count = 0;
36 36
 		$collist = array( );
... ...
@@ -1,9 +1,8 @@
1 1
 <?php
2 2
 
3 3
 if(function_exists("mysqli_connect")) include_once(_BASEDIR."includes/mysqli_functions.php");
4
-else if(function_exists("mysql_connect")) include_once(_BASEDIR."includes/mysql_functions.php");
5 4
 else {
6 5
 	include(_BASEDIR."languages/en.php"); // Because we haven't selected a language setting yet
7 6
 	die(_FATALERROR._NODBFUNCTIONALITY);
8 7
 }
9
-?>
10 8
\ No newline at end of file
9
+ 
11 10
\ No newline at end of file
12 11
deleted file mode 100644
... ...
@@ -1,70 +0,0 @@
1
-<?php
2
-
3
-// Some DB functions 
4
-
5
-if(!function_exists("dbconnect")) { // just in case.  Some people seemed to be having an issue and this was the easiest fix.
6
-
7
-function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
8
-	$mysql_access = mysql_connect($dbhost, $dbuser, $dbpass);
9
-	if(!$mysql_access) {
10
-		include(_BASEDIR."languages/en.php");
11
-		die(_FATALERROR." "._NOTCONNECTED);
12
-	}
13
-	mysql_select_db($dbname, $mysql_access);
14
-	mysql_query("SET SESSION sql_mode = 'MYSQL40'");
15
-	return $mysql_access;
16
-}
17
-
18
-
19
-function dbquery($query) {
20
-	global $debug, $headerSent, $dbconnect;
21
-	if($debug  && $headerSent) echo "<!-- $query -->\n";
22
-	$result = mysql_query($query, $dbconnect) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ) : ""));
23
-	return $result;
24
-}
25
-
26
-function dbnumrows($query) {
27
-	global $debug, $dbconnect;
28
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
29
-		echo "<!-- dbnumrows ".mysql_error( )." -->\n";
30
-	}
31
-	$query = mysql_num_rows($query);
32
-	return $query;
33
-}
34
-
35
-function dbassoc($query) {
36
-	global $debug, $dbconnect;
37
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
38
-		echo "<!-- dbassoc ".mysql_error( )." -->\n";
39
-	}
40
-	$query = mysql_fetch_assoc($query);
41
-	return $query;
42
-}
43
-
44
-function dbinsertid($tablename = 0) {
45
-	return mysql_insert_id( );
46
-}
47
-
48
-function dbrow($query) {
49
-	global $debug, $dbconnect;
50
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
51
-		if($error) echo "<!-- dbrow ".mysql_error( )." -->\n";
52
-	}
53
-	$query = mysql_fetch_row($query);
54
-	return $query;
55
-}
56
-
57
-// Used to escape text being put into the database.
58
-function escapestring($str) {
59
-   if (!is_array($str)) return mysql_real_escape_string($str);
60
-   else return array_map('escapestring', $str);
61
-}
62
-
63
-function dbclose( ) {
64
-	global $dbconnect;
65
-	mysql_close($dbconnect);
66
-
67
-}
68
-// End DB functions
69
-}
70
-?>
71 0
\ No newline at end of file
... ...
@@ -18,14 +18,14 @@ function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
18 18
 function dbquery($query) {
19 19
 	global $debug, $headerSent, $dbconnect;
20 20
 	if($debug && $headerSent) echo "<!-- $query -->\n";
21
-	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->mysqli_errno.") ".$dbconnect->mysqli_error : ""));
21
+	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->errno.") ".$dbconnect->error : ""));
22 22
 	return $result;
23 23
 }
24 24
 
25 25
 function dbnumrows($query) {
26 26
 	global $debug, $dbconnect;
27 27
 	if ($query === false && $debug) {
28
-		echo "<!-- dbnumrows ".$dbconnect->mysqli_error." -->\n";
28
+		echo "<!-- dbnumrows ".$dbconnect->error." -->\n";
29 29
 	}
30 30
 	return $query->num_rows;
31 31
 }
... ...
@@ -33,7 +33,7 @@ function dbnumrows($query) {
33 33
 function dbassoc($query) {
34 34
 	global $debug, $dbconnect;
35 35
 	if ($query === false && $debug) {
36
-		echo "<!-- dbassoc ".$dbconnect->mysqli_error." -->\n";
36
+		echo "<!-- dbassoc ".$dbconnect->errno." -->\n";
37 37
 	}
38 38
 	return $query->fetch_assoc();
39 39
 }
... ...
@@ -46,7 +46,7 @@ function dbinsertid($tablename = 0) {
46 46
 function dbrow($query) {
47 47
 	global $debug, $dbconnect;
48 48
 	if ($query === false && $debug) {
49
-		if($error) echo "<!-- dbrow ".$dbconnect->mysqli_error." -->\n";
49
+		if($dbconnect->error) echo "<!-- dbrow ".$dbconnect->errno." -->\n";
50 50
 	}
51 51
 	return $query->fetch_row();
52 52
 }
... ...
@@ -71,7 +71,7 @@ if(!defined("_CHARSET")) exit( );
71 71
 	if(count($storycodeblocks)) foreach($storycodeblocks as $c) { eval($c); } 
72 72
 	$tpl->assign("classifications", $allclasslist);
73 73
 	$seriesquery = "SELECT series.* FROM ".TABLEPREFIX."fanfiction_inseries as list, ".TABLEPREFIX."fanfiction_series as series WHERE list.sid = '".$stories['sid']."' AND series.seriesid = list.seriesid";
74
-	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (".mysql_errno( ).") ".mysql_error( ));
74
+	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (". $dbconnect->errno.") ". $dbconnect->error);
75 75
 	$serieslinks = array( );
76 76
 	while($s = dbassoc($seriesresult)) {
77 77
 		if(isset($action) && $action == "printable") $serieslinks[] = stripslashes($s['title']);
... ...
@@ -971,13 +971,13 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
971 971
 			$language = $_POST['language'];
972 972
 			$sitekey = descript($_POST['sitekey']);
973 973
 			$settingsprefix = descript($_POST['settingsprefix']);
974
-			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
975
-			if (!$mysql_access)
974
+			$mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass);
975
+			if (!$mysqli_access)
976 976
 			{
977 977
 				$output .= write_message(_CONFIGFAILED);
978 978
 			}
979 979
 		}
980
-		if (isset($_POST['submit']) && $mysql_access)
980
+		if (isset($_POST['submit']) && $mysqli_access)
981 981
 		{
982 982
 			$handle = fopen("../config.php", 'w');
983 983
 			if (!$handle)
... ...
@@ -1016,7 +1016,7 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1016 1016
 		}
1017 1017
 		else
1018 1018
 		{
1019
-			if (file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
1019
+			if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
1020 1020
 			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1021 1021
 			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
1022 1022
 			else