Browse code

Add includes/dbfunctions.php include back to config.php, but leave the actual dbconnect in the includes/dbfunctions.php file where it belongs - this makes legacy modules work without adding another include

Clarissa Walker authored on 2026/09/05 13:38:55
Showing 1 changed files
... ...
@@ -26,7 +26,6 @@
26 26
 		if(!defined("_LOGINCHECK")) exit( );
27 27
 		define("_BASEDIR", "");
28 28
 		include_once("config.php");
29
-		include(_BASEDIR . "includes/dbfunctions.php");
30 29
 		$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
31 30
 		list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings);
32 31
 		$tempdebug = $debug;
Browse code

3.5.8.1 warnings, dbconnect, install changes

Jimako authored on 2024/05/09 06:30:39
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@
26 26
 		if(!defined("_LOGINCHECK")) exit( );
27 27
 		define("_BASEDIR", "");
28 28
 		include_once("config.php");
29
+		include(_BASEDIR . "includes/dbfunctions.php");
29 30
 		$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
30 31
 		list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings);
31 32
 		$tempdebug = $debug;
... ...
@@ -110,7 +111,12 @@
110 111
 			if($link['link_access'] == 2 && !isADMIN) continue;
111 112
 			$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
112 113
 		}
113
-		$output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>";
114
+		$output .= "<div style='text-align: center;'>";
115
+		if(isset($pagelinks['register'])) {
116
+			$output .= $pagelinks['register']['link']." | ";
117
+		}
118
+		$output .= $pagelinks['lostpassword']['link']."</div>";
119
+		 
114 120
 	}
115 121
 }
116 122
 ?>
Browse code

prevention undefined constant is_MEMBER

Jimako authored on 2024/04/09 08:18:11
Showing 1 changed files
... ...
@@ -93,7 +93,10 @@
93 93
 		}
94 94
 		$debug = $tempdebug;
95 95
 	}
96
-	else if(!isMEMBER) {
96
+	else {
97
+		require_once("header.php");
98
+		if(!isMEMBER) {
99
+		
97 100
 		$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
98 101
 		$output .= "<div style=\"width: 250px; margin: 0 auto; text-align: center;\"><form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=login".(isset($_GET['sid']) && isNumber($_GET['sid']) ? "&amp;sid=".$_GET['sid'] : "")."\">
99 102
 		<div class=\"label\" style=\"float: left;  width: 30%; text-align: right;\"><label for=\"penname\">"._PENNAME.":</label></div><INPUT type=\"text\" class=\"textbox\" name=\"penname\" id=\"penname\"><br />
... ...
@@ -109,4 +112,5 @@
109 112
 		}
110 113
 		$output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>";
111 114
 	}
112
-?>
113 115
\ No newline at end of file
116
+}
117
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,112 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// eFiction 3.2
4
+// Copyright (c) 2007 by Tammy Keefer
5
+// Valid HTML 4.01 Transitional
6
+// Based on eFiction 1.1
7
+// Copyright (C) 2003 by Rebecca Smallwood.
8
+// http://efiction.sourceforge.net/
9
+// ----------------------------------------------------------------------
10
+// LICENSE
11
+//
12
+// This program is free software; you can redistribute it and/or
13
+// modify it under the terms of the GNU General Public License (GPL)
14
+// as published by the Free Software Foundation; either version 2
15
+// of the License, or (at your option) any later version.
16
+//
17
+// This program is distributed in the hope that it will be useful,
18
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+// GNU General Public License for more details.
21
+//
22
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
+// ----------------------------------------------------------------------
24
+
25
+	if(isset($_POST['submit']) && preg_match("!^[-a-z0-9_ ]{3,30}$!i", $_POST['penname'])) {
26
+		if(!defined("_LOGINCHECK")) exit( );
27
+		define("_BASEDIR", "");
28
+		include_once("config.php");
29
+		$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
30
+		list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings);
31
+		$tempdebug = $debug;
32
+		$debug = 0;
33
+		define("TABLEPREFIX", $tableprefix);
34
+		define("SITEKEY", $sitekey);
35
+		include_once("includes/queries.php");
36
+		$result = dbquery("SELECT *, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs AS ap ON ap.uid = "._UIDFIELD." WHERE "._PENNAMEFIELD." = '".$_POST['penname']."'");
37
+		$passwd = dbassoc($result);
38
+		if(!dbnumrows($result)) {
39
+			require_once("header.php");
40
+			//make a new TemplatePower object
41
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
42
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
43
+			include_once("includes/pagesetup.php");
44
+			$output = write_error(_NOSUCHACCOUNT);
45
+			$tpl->assign("output", $output);
46
+			$tpl->printToScreen( );
47
+			dbclose( );
48
+			exit( );
49
+		}
50
+		if($maintenance && $passwd['level'] < 0) {
51
+			header("Location: maintenance.php");
52
+			exit( );
53
+		}
54
+		$encryptedpassword = md5($_POST['password']);
55
+		if($passwd['level'] == -1) {
56
+			require_once("header.php");
57
+			//make a new TemplatePower object
58
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
59
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
60
+			include_once("includes/pagesetup.php");
61
+			$output = write_error(_ACCOUNTLOCKED);
62
+			$tpl->assign("output", $output);
63
+			$tpl->printToScreen( );
64
+			dbclose( );
65
+			exit( );
66
+		}
67
+		if($passwd['password'] == $encryptedpassword) {
68
+			if(isset($_POST['cookiecheck'])) {
69
+				setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
70
+				setcookie($sitekey."_salt", md5($passwd['email'] . $encryptedpassword),  time()+60*60*24*30, "/");
71
+			}
72
+			if(!isset($_SESSION)) session_start( );
73
+			$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
74
+			$_SESSION[$sitekey."_salt"] = md5($passwd['email'] . $encryptedpassword);
75
+			$logincode = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'login'");
76
+			while($code = dbassoc($logincode)) {
77
+				eval($code['code_text']);
78
+			}
79
+		}
80
+
81
+		else { 
82
+			require_once("header.php");
83
+			//make a new TemplatePower object
84
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
85
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
86
+			include_once("includes/pagesetup.php");
87
+			$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
88
+			$output .= "<div style='text-align: center;'>"._WRONGPASSWORD."</div>";
89
+			$tpl->assign("output", $output);
90
+			$tpl->printToScreen( );
91
+			dbclose( );
92
+			exit( );
93
+		}
94
+		$debug = $tempdebug;
95
+	}
96
+	else if(!isMEMBER) {
97
+		$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
98
+		$output .= "<div style=\"width: 250px; margin: 0 auto; text-align: center;\"><form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=login".(isset($_GET['sid']) && isNumber($_GET['sid']) ? "&amp;sid=".$_GET['sid'] : "")."\">
99
+		<div class=\"label\" style=\"float: left;  width: 30%; text-align: right;\"><label for=\"penname\">"._PENNAME.":</label></div><INPUT type=\"text\" class=\"textbox\" name=\"penname\" id=\"penname\"><br />
100
+		<div class=\"label\" style=\"float: left; width: 30%; text-align: right;\"><label for=\"pswd\">"._PASSWORD.":</label></div><INPUT type=\"password\" class=\"textbox\" id=\"pswd\" name=\"password\"><br />
101
+		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck\">"._REMEMBERME."</label><br />
102
+		<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">
103
+		</form></div>";
104
+		$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = 'login' OR link_name = 'lostpassword'");
105
+		while($link = dbassoc($linkquery)) {
106
+			if($link['link_access'] && !isMEMBER) continue;
107
+			if($link['link_access'] == 2 && !isADMIN) continue;
108
+			$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
109
+		}
110
+		$output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>";
111
+	}
112
+?>
0 113
\ No newline at end of file