Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,27 @@
1
+<?php
2
+define("_BASEDIR", "../");
3
+include("../config.php");
4
+include("../includes/dbfunctions.php");
5
+list($tableprefix, $lang) = dbrow(dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'"));
6
+define("TABLEPREFIX", $tableprefix);
7
+include(_BASEDIR."languages/$lang.php");
8
+//header("Content-Type: text/html; charset=".CHARSET,true);
9
+include("../includes/queries.php");
10
+// Checks that the given $num is actually a number.  Used to help prevent XSS attacks.
11
+function isNumber($num) {
12
+	if(empty($num)) return false;
13
+	return (preg_match("/^[0-9]+$/", $num) || $num == "-1" ? true : false);
14
+}
15
+
16
+$catid = isset($_GET['catid']) ? explode(",", $_GET['catid']) : array(-1);
17
+$catid = array_filter($catid, "isNumber");
18
+$characters = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_characters WHERE ".(count($catid) > 1 ? "FIND_IN_SET(catid, '".implode(",", $catid)."') > 0" : "catid = '".$catid[0]."'")." ORDER BY charname");
19
+echo "var element = '".$_GET['element']."';\n";
20
+$x = 0;
21
+$find = array ('"', chr(150), chr(147), chr(148), chr(146));
22
+$replace = array ('\"', "-", "\"", "\"", "'");
23
+while($char = dbassoc($characters)) {
24
+	echo "characters[$x] = new Array(".$char['charid'].", \"".urlencode(str_replace($find, $replace, stripslashes($char['charname'])))."\");\r\n";
25
+	$x++;
26
+}
27
+?>
0 28
\ No newline at end of file