removed mysql functions
removed mysql functions

--- a/admin/stories.php
+++ b/admin/stories.php
@@ -25,17 +25,17 @@
 
 if(!defined("_CHARSET")) exit( );
 function featured( ) {
-	global $tableprefix;
+	global $tableprefix, $dbconnect;
 
 	if($_GET['retire'])
-		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
 	if($_GET['feature'])
-		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
 	$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";
-	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
-	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
-	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
-	while($story = mysql_fetch_array($fresult)) {
+	$fresult = dbquery($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
+	$output = "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
+	if(!dbnumrows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
+	while($story = dbassoc($fresult)) {
 		$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>";
 	}
 	$output .= "</table>"._FEATUREDNOTE;
@@ -45,17 +45,17 @@
 
 function submitted()
 {
-	global $tableprefix, $admincats, $allowed_tags;
-		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
+	global $tableprefix, $admincats, $allowed_tags, $dbconnect;
+		$output = "<center><h4>"._SUBMITTED."</h4></center>";
 		$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";
-		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
+		$result = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
 		$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>";
 		$array = explode(",", $admincats);
-		while ($story = mysql_fetch_assoc($result))
+		while ($story = dbassoc($result))
 		{
 			unset($catstring);
-			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
-			while($cats = mysql_fetch_array($result3)) {
+			$result3 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
+			while($cats = dbassoc($result3)) {
 				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
 			}
 			if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) {
@@ -76,14 +76,14 @@
 function validate( ) {
 	global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson;
 
-	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
+	$output  = "<center><h4>"._VIEWSUBMITTED."</h4></center>";
 	if($_GET['validate'] == "yes") {
-		$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");
-		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
+		$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");
+		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = dbassoc($storyquery);
 		if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) {
 			include("includes/emailer.php");
 			if($validated != "1") {
-				mysql_query("UPDATE ".TABLEPREFIX. "fanfiction_stories SET validated = '1', updated = '".time()."' WHERE sid = '".$_GET['sid']."'");
+				dbquery("UPDATE ".TABLEPREFIX. "fanfiction_stories SET validated = '1', updated = '".time()."' WHERE sid = '".$_GET['sid']."'");
 				$categories = explode(",", $catid);
 				include("functions.php");
 				foreach($categories as $cat) {
@@ -92,8 +92,8 @@
 				if($alertson) {
 					$subject = _NEWSTORYAT;
 					$mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid);
-					$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");
-					while($favuser = mysql_fetch_array($favorites)) { 
+					$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");
+					while($favuser = dbassoc($favorites)) { 
 						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
 					}				
 				}
@@ -101,28 +101,28 @@
 			else if($alertson) {
 				$subject = _STORYALERT;
 				$mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder);
-				$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");
-				while($favuser = mysql_fetch_array($favorites)) { 
+				$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");
+				while($favuser = dbassoc($favorites)) { 
 					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
 				}
 			}
-			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
-			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' WHERE sid = '$sid'");
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' WHERE sid = '$sid'");
 			$output .= "<center><b>"._STORYVALIDATED."</b></center>";
 		}
 		else
 			$output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN."  "._TRYAGAIN."</center><br /><br />";
 	}
 	else {
-			$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");
-			$story = mysql_fetch_array($result);
+			$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");
+			$story = dbassoc($result);
 			$output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />";
 			$output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title'];
 			$output .= "<br />";
-			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
+			$result3 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
 			$catstring = "";
 			$count = 0;
-			while($cats = mysql_fetch_array($result3)) {
+			while($cats = dbassoc($result3)) {
 				if($count > 0) $catstring .= ", ";
 				$catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
 				$categories[] = $cats['catid'];
@@ -183,10 +183,10 @@
 		else echo "<div style='text-align: center;'>"._ERROR."</div>";
 	}
 	else {
-			$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
-			$author = mysql_fetch_array($authorquery);
-			$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");
-			$story = mysql_fetch_array($storyquery);
+			$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
+			$author = dbassoc($authorquery);
+			$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");
+			$story = dbassoc($storyquery);
 			$letter = file_get_contents("messages/thankyou.txt");
 			echo "<body>";
 			echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
@@ -220,10 +220,10 @@
 	}
 	else
 	{
-		$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
-		$author = mysql_fetch_array($authorquery);
-		$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");
-		$story = mysql_fetch_array($storyquery);
+		$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
+		$author = dbassoc($authorquery);
+		$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");
+		$story = dbassoc($storyquery);
 		$letter = file_get_contents("messages/nothankyou.txt");
 		echo "<body>";
 		echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";

--- a/admin/warnings.php
+++ b/admin/warnings.php
@@ -26,9 +26,9 @@
 if(!defined("_CHARSET")) exit( );
 
 function warnings( ) {
-	global $allowed_tags;
+	global $allowed_tags, $dbconnect;
 
-	$output .= "<center><h4>"._WARNINGS."</h4></center>";
+	$output = "<center><h4>"._WARNINGS."</h4></center>";
 	if($_GET["delete"]) {
 		$wid = $_GET["delete"];
 		if($_GET["confirm"] == "yes")
@@ -68,14 +68,14 @@
 		}
 	}
 	if ($_POST['submit']) {
-		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( ));
-		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( ));
+		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);
+		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);
 			$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
 	}
 	else {
 		if(isset($_GET['warning'])) {
 			if($_GET['warning'] != "new") {
-				$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( ));
+				$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);
 				$warning = dbassoc($warnquery);
 			}
 			$output .=  "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=warnings&warning=".$_GET['warning']."\">

--- a/blocks/categories/categories.php
+++ b/blocks/categories/categories.php
@@ -30,7 +30,7 @@
 	if($multiplecats) {
 		$displaycolumns = $displaycolumns ? $displaycolumns : 1;
 		$query = "SELECT * FROM ".TABLEPREFIX."fanfiction_categories WHERE parentcatid = '-1' ORDER BY displayorder";
-		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
+		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
 		$total = dbnumrows($result4);
 		$count = 0;
 		$collist = array( );

--- a/includes/dbfunctions.php
+++ b/includes/dbfunctions.php
@@ -1,9 +1,8 @@
 <?php
 
 if(function_exists("mysqli_connect")) include_once(_BASEDIR."includes/mysqli_functions.php");
-else if(function_exists("mysql_connect")) include_once(_BASEDIR."includes/mysql_functions.php");
 else {
 	include(_BASEDIR."languages/en.php"); // Because we haven't selected a language setting yet
 	die(_FATALERROR._NODBFUNCTIONALITY);
 }
-?>
+ 

--- a/includes/mysql_functions.php
+++ /dev/null
@@ -1,70 +1,1 @@
-<?php
 
-// Some DB functions 
-
-if(!function_exists("dbconnect")) { // just in case.  Some people seemed to be having an issue and this was the easiest fix.
-
-function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
-	$mysql_access = mysql_connect($dbhost, $dbuser, $dbpass);
-	if(!$mysql_access) {
-		include(_BASEDIR."languages/en.php");
-		die(_FATALERROR." "._NOTCONNECTED);
-	}
-	mysql_select_db($dbname, $mysql_access);
-	mysql_query("SET SESSION sql_mode = 'MYSQL40'");
-	return $mysql_access;
-}
-
-
-function dbquery($query) {
-	global $debug, $headerSent, $dbconnect;
-	if($debug  && $headerSent) echo "<!-- $query -->\n";
-	$result = mysql_query($query, $dbconnect) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ) : ""));
-	return $result;
-}
-
-function dbnumrows($query) {
-	global $debug, $dbconnect;
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
-		echo "<!-- dbnumrows ".mysql_error( )." -->\n";
-	}
-	$query = mysql_num_rows($query);
-	return $query;
-}
-
-function dbassoc($query) {
-	global $debug, $dbconnect;
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
-		echo "<!-- dbassoc ".mysql_error( )." -->\n";
-	}
-	$query = mysql_fetch_assoc($query);
-	return $query;
-}
-
-function dbinsertid($tablename = 0) {
-	return mysql_insert_id( );
-}
-
-function dbrow($query) {
-	global $debug, $dbconnect;
-	if ($query === false && mysql_errno( ) > 0 && $debug) {
-		if($error) echo "<!-- dbrow ".mysql_error( )." -->\n";
-	}
-	$query = mysql_fetch_row($query);
-	return $query;
-}
-
-// Used to escape text being put into the database.
-function escapestring($str) {
-   if (!is_array($str)) return mysql_real_escape_string($str);
-   else return array_map('escapestring', $str);
-}
-
-function dbclose( ) {
-	global $dbconnect;
-	mysql_close($dbconnect);
-
-}
-// End DB functions
-}
-?>

--- a/includes/mysqli_functions.php
+++ b/includes/mysqli_functions.php
@@ -18,14 +18,14 @@
 function dbquery($query) {
 	global $debug, $headerSent, $dbconnect;
 	if($debug && $headerSent) echo "<!-- $query -->\n";
-	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->mysqli_errno.") ".$dbconnect->mysqli_error : ""));
+	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->errno.") ".$dbconnect->error : ""));
 	return $result;
 }
 
 function dbnumrows($query) {
 	global $debug, $dbconnect;
 	if ($query === false && $debug) {
-		echo "<!-- dbnumrows ".$dbconnect->mysqli_error." -->\n";
+		echo "<!-- dbnumrows ".$dbconnect->error." -->\n";
 	}
 	return $query->num_rows;
 }
@@ -33,7 +33,7 @@
 function dbassoc($query) {
 	global $debug, $dbconnect;
 	if ($query === false && $debug) {
-		echo "<!-- dbassoc ".$dbconnect->mysqli_error." -->\n";
+		echo "<!-- dbassoc ".$dbconnect->errno." -->\n";
 	}
 	return $query->fetch_assoc();
 }
@@ -46,7 +46,7 @@
 function dbrow($query) {
 	global $debug, $dbconnect;
 	if ($query === false && $debug) {
-		if($error) echo "<!-- dbrow ".$dbconnect->mysqli_error." -->\n";
+		if($dbconnect->error) echo "<!-- dbrow ".$dbconnect->errno." -->\n";
 	}
 	return $query->fetch_row();
 }

--- a/includes/storyblock.php
+++ b/includes/storyblock.php
@@ -71,7 +71,7 @@
 	if(count($storycodeblocks)) foreach($storycodeblocks as $c) { eval($c); } 
 	$tpl->assign("classifications", $allclasslist);
 	$seriesquery = "SELECT series.* FROM ".TABLEPREFIX."fanfiction_inseries as list, ".TABLEPREFIX."fanfiction_series as series WHERE list.sid = '".$stories['sid']."' AND series.seriesid = list.seriesid";
-	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (".mysql_errno( ).") ".mysql_error( ));
+	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (". $dbconnect->errno.") ". $dbconnect->error);
 	$serieslinks = array( );
 	while($s = dbassoc($seriesresult)) {
 		if(isset($action) && $action == "printable") $serieslinks[] = stripslashes($s['title']);

--- a/install/install.php
+++ b/install/install.php
@@ -971,13 +971,13 @@
 			$language = $_POST['language'];
 			$sitekey = descript($_POST['sitekey']);
 			$settingsprefix = descript($_POST['settingsprefix']);
-			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
-			if (!$mysql_access)
+			$mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass);
+			if (!$mysqli_access)
 			{
 				$output .= write_message(_CONFIGFAILED);
 			}
 		}
-		if (isset($_POST['submit']) && $mysql_access)
+		if (isset($_POST['submit']) && $mysqli_access)
 		{
 			$handle = fopen("../config.php", 'w');
 			if (!$handle)
@@ -1016,7 +1016,7 @@
 		}
 		else
 		{
-			if (file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
+			if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
 			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
 			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
 			else