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,69 @@
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(!defined("_CHARSET")) exit( );
26
+// Get session variables from cookie data if not logged in.
27
+// To bridge to another program replace (or add to) this information with the bridge to your other script.  See examples in the includes/bridges/ folder.
28
+if (!empty($_COOKIE[$sitekey."_useruid"])) {
29
+	$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_COOKIE[$sitekey."_useruid"]."'"));
30
+	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
31
+		define("USERUID", $userdata['uid']);
32
+		define("USERPENNAME", $userdata['penname']);
33
+		// the following line fixes missing authorpref rows
34
+		if(empty($userdata['userskin'] )) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$userdata['uid']."', '$defaultskin', '$displayindex', '$defaultsort', '$tinyMCE')");
35
+		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
36
+		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
37
+		else $siteskin = $defaultskin;
38
+		define("uLEVEL", $userdata['level']);
39
+		define("isADMIN", uLEVEL > 0 ? true : false);
40
+		define("isMEMBER", true);
41
+		if(EMPTY($_SESSION[$sitekey."_ageconsent"])) $ageconsent = $userdata['ageconsent'];
42
+		else $ageconsent = $_SESSION[$sitekey."_ageconsent"];
43
+	}
44
+}
45
+if(!empty($_SESSION[$sitekey."_useruid"]) && !defined("USERUID")) {
46
+	$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_SESSION[$sitekey."_useruid"]."'"));
47
+	if($userdata && $userdata['level'] != -1 && $_SESSION[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
48
+		define("USERUID", $userdata['uid']);        
49
+		define("USERPENNAME", $userdata['penname']);
50
+		// the following line fixes missing authorpref rows
51
+		if(empty($userdata['userskin'] )) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$userdata['uid']."', '$defaultskin', '$displayindex', '$defaultsort', '$tinyMCE')");
52
+		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
53
+		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
54
+		else $siteskin = $defaultskin;
55
+		define("uLEVEL", $userdata['level']);
56
+		define("isADMIN", uLEVEL > 0 ? true : false);
57
+		define("isMEMBER", true);
58
+		if(!isset($_SESSION[$sitekey."_ageconsent"])) $ageconsent = $userdata['ageconsent'];
59
+		else $ageconsent = $_SESSION[$sitekey."_ageconsent"];
60
+	}
61
+}
62
+if(!defined("USERUID")) define("USERUID", 0);
63
+if(!defined("USERPENNAME")) define("USERPENNAME", false);
64
+if(!defined("uLEVEL")) define("uLEVEL", 0);
65
+if(!defined("isMEMBER")) define("isMEMBER", false);
66
+if(!defined("isADMIN")) define("isADMIN", false);
67
+if(empty($siteskin)) $siteskin = $defaultskin;
68
+
69
+?>
0 70
\ No newline at end of file