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,54 @@
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
+if (isset($_COOKIE['fusion_user']) && !defined("isMEMBER")) {
28
+	$cookie_vars = explode(".", $_COOKIE['fusion_user']);
29
+	$cookie_1 = preg_match("/^[0-9]+$/", $cookie_vars['0']) ? $cookie_vars['0'] : "0";
30
+	$cookie_2 = (preg_match("/^[0-9a-z]{32}$/", $cookie_vars['1']) ? $cookie_vars['1'] : "");
31
+	$userdata = dbassoc(dbquery("SELECT * FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_authorprefs as ap) WHERE "._UIDFIELD." = '$cookie_1' AND "._PASSWORDFIELD." ='$cookie_2' AND "._UIDFIELD." = ap.uid"));
32
+	if($userdata) {
33
+		if($userdata['uid'] == 0) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$userdata['user_id']."', '$defaultskin', '$displayindex', '$defaultsort', '$tinyMCE')");
34
+		define("USERUID", $userdata['user_id']);
35
+		define("USERPENNAME", $userdata['user_name']);
36
+		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
37
+		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
38
+		else $siteskin = $defaultskin;
39
+		define("uLEVEL", $userdata['level']);
40
+		define("isADMIN", uLEVEL > 0 ? true : false);
41
+		define("isMEMBER", true);
42
+		if(!isset($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
43
+		else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
44
+		if (empty($_COOKIE['fusion_lastvisit'])) 
45
+			setcookie("fusion_lastvisit", $userdata['user_lastvisit'], time() + 3600, "/", "", "0");
46
+	}
47
+}
48
+if(!defined("USERUID")) define("USERUID", false);
49
+if(!defined("USERPENNAME")) define("USERPENNAME", false);
50
+if(!defined("uLEVEL")) define("uLEVEL", 0);
51
+if(!defined("isMEMBER")) define("isMEMBER", false);
52
+if(!defined("isADMIN")) define("isADMIN", false);
53
+
54
+?>
0 55
\ No newline at end of file