Browse code

Update eFic2eFic bridge and default file backups

Clarissa Walker authored on 2026/09/08 10:09:37
Showing 9 changed files
... ...
@@ -1,224 +1,250 @@
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
-if(!function_exists("random_char")) {
27
-
28
-function random_char($string)
29
-{
30
-	$length = strlen($string);
31
-	$position = mt_rand(0, $length - 1);
32
-	$output = ($string[$position]);
33
-	return $output;
34
-}
35
-
36
-function random_string ($charset_string, $length)
37
-{
38
-	$return_string = random_char($charset_string);
39
-	for ($x = 1; $x < $length; $x++)
40
-	$return_string .= random_char($charset_string);
41
-	return $return_string;
42
-}
43
-
44
-}
45
-	$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
46
-	if(!$uid) $uid = USERUID;
47
-
48
-	if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") $output .= write_error(_NOTAUTHORIZED);
49
-	if(isMEMBER) $output .= "<div id=\"pagetitle\">"._EDITPERSONAL."</div>";
50
-	else $output .= "<div id=\"pagetitle\">"._NEWACCOUNT."</div>";
51
-	if(!empty($_POST['submit'])) {
52
-		$penname = isset($_POST['newpenname']) ? escapestring($_POST['newpenname']) : false;
53
-		$email = escapestring($_POST[email]);
54
-		if(!isset($email) && !isADMIN) $output .= "<div style='text-align: center;'>"._EMAILREQUIRED."</div>";
55
-		else if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $output .= "<div style='text-align: center;'>"._BADUSERNAME."</div>";
56
-		else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) $output .= "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
57
-		else if($action == "register") {
58
-			if(!$penname || empty($email) || !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) || !preg_match("/^[-0-9A-Z_-\s]+$/i", $penname)) $output .= write_error(_PENEMAILREQUIRED);
59
-			else if($pwdsetting && empty($_POST['password'])) $output .= write_error(_PWDREQUIRED."  "._TRYAGAIN);
60
-			else  {
61
-				$result = dbquery("SELECT "._PENNAMEFIELD." FROM "._AUTHORTABLE." WHERE "._PENNAMEFIELD." = '".escapestring($penname)."'");
62
-				$result2 = dbquery("SELECT "._EMAILFIELD." as email FROM "._AUTHORTABLE." WHERE "._EMAILFIELD." = ''");
63
-				if($captcha && !captcha_confirm()) $output .= write_error(_CAPTCHAFAIL);
64
-				else if(dbnumrows($result) > 0) $output .= write_error(_PENNAMEINUSE."  "._TRYAGAIN);
65
-				else if(dbnumrows($result2) > 0) $output .= write_error(_EMAILINUSE."  "._TRYAGAIN);
66
-				else if(preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) {
67
-					if(!$pwdsetting) {
68
-						$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
69
-						$pass = random_string($charset, 10);
70
-						$encryppass = md5($pass);
71
-					}
72
-					else {
73
-						if($_POST['password'] != $_POST['password2']) {
74
-							$output .=  write_error(_PASSWORDTWICE);
75
-							$tpl->assign("output", $output);
76
-							$tpl->printToScreen( );
77
-							dbclose( );
78
-							exit( );
79
-						}
80
-						$pass = $_POST['password2'];
81
-						$encryppass = md5($pass);
82
-					}
83
-					dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." (penname, realname, bio, email, date, password) VALUES ('".escapestring($penname)."', '".escapestring(strip_tags($_POST['realname']))."', '".strip_tags(escapestring($_POST['bio']), $allowed_tags)."', '$email', now(), '$encryppass')");
84
-					$useruid = dbinsertid( );
85
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, USERUID, $_SERVER['REMOTE_ADDR']))."', '".$useruid."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG')");
86
-					if(empty($siteskin)) {
87
-						$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey ='".SITEKEY."'");
88
-						list($skin) = dbrow($skinquery);
89
-					}
90
-					else $skin = $siteskin;
91
-					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".USERUID."', '$skin', '$displayindex', '$defaultsort', '$tinyMCE')");
92
-/* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
93
-					$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
94
-					while($field = dbassoc($fields)) {
95
-						$uid = isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : false;
96
-						if(!$uid) continue;
97
-						$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$uid."'");
98
-						if(dbnumrows($oldfield) > 0) {
99
-							$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring($_POST["af_".$field['field_name']]) : false;
100
-							if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='$newinfo' WHERE uid = '$uid' AND field = '".$field['field_id']."'");
101
-							else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid' AND field = '".$field['field_id']."'");
102
-						}
103
-						else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$uid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
104
-					}
105
-/* End dynamic fields */
106
-					$subject = _SIGNUPSUBJECT;
107
-					$mailtext = _SIGNUPMESSAGE._LOGIN.": $penname\n"._PASSWORD.": $pass \n\n";
108
-					if(!$pwdsetting) $mailtext .= _SIGNUPWARNING;
109
-					include("includes/emailer.php");
110
-					sendemail($penname, $email, $sitename, $siteemail, $subject, $mailtext, "html");
111
-					dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET newestmember = '$penname', members = members + 1");
112
-					unset($_POST['submit']);
113
-					$output = write_message(_ACTIONSUCCESSFUL);
114
-					include("user/login.php");
115
-				}
116
-				else $output .= _BADUSERNAME;
117
-			}
118
-		}
119
-		else{
120
-			$oldinfo = dbassoc(dbquery("SELECT * FROM "._AUTHORTABLE." WHERE uid = '".USERUID."' LIMIT 1"));
121
-			// Update the password
122
-			if(($_POST['password']) || ($_POST['password2'])) {
123
-				if($_POST['password'] == $_POST['password2']) {
124
-					$encryppassword = md5($_POST['password']);
125
-					dbquery("UPDATE "._AUTHORTABLE." SET password='$encryppassword' WHERE uid = '$uid'");
126
-				}
127
-				else $output .=  write_error(_PASSWORDTWICE);
128
-			}
129
-			// Update the penname.
130
-			if(isset($_POST['oldpenname']) && $penname != $_POST['oldpenname']) {
131
-				$checkresult = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE penname = '".escapestring($penname)."'");
132
-				if(dbnumrows($checkresult)) {
133
-					$output .= write_message(_PENNAMEINUSE."  "._TRYAGAIN);
134
-				}
135
-				else {
136
-					dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$_POST[uid]'");
137
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST[oldpenname], $uid, $penname))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB')");
138
-				}
139
-			}
140
-/* This section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
141
-			$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
142
-			while($field = dbassoc($fields)) {
143
-				$uid = isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : false;
144
-				if(!$uid) continue;
145
-				$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$uid."'");
146
-				if(dbnumrows($oldfield) > 0) {
147
-					$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring(descript($_POST["af_".$field['field_name']])) : false;
148
-					if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='".$newinfo."' WHERE uid = '$uid' AND field = '".descript($field['field_id'])."'");
149
-					else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid' AND field = '".$field['field_id']."'");
150
-				}
151
-				else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$uid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
152
-			}
153
-/* End dynamic fields */
154
-			// Now we'll update the rest.
155
-			$result = dbquery("UPDATE "._AUTHORTABLE." SET realname='".descript(strip_tags(escapestring($_POST['realname'])), $allowed_tags)."', email='$email', bio='".descript(strip_tags(escapestring($_POST['bio']), $allowed_tags))."', image='".($imageupload && !empty($_POST['image']) ? escapestring($_POST['image']) : "")."' WHERE uid = '$uid'");
156
-			if($result) { // only if the info actually got updated.
157
-				if($oldinfo['email'] != $email) { // Need to reset the session and cookies in this case.
158
-					$_SESSION[SITEKEY."_salt"] = md5($email+$encryptedpassword);
159
-					if(isset($_COOKIE[SITEKEY."_salt"])) setcookie(SITEKEY."_salt", md5($email+$encryptedpassword),  time()+60*60*24*30, "/");		
160
-				}
161
-			}
162
-			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT));
163
-		}
164
-	}
165
-	else {
166
-		if($action != "register") {
167
-			$result = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
168
-			$user = dbassoc($result);
169
-			$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
170
-			while($field = dbassoc($result2)) {
171
-				$user["af_".$field['field']] = $field['info'];
172
-			}
173
-		}
174
-		if($action == "register") {
175
-			$query = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'tos'");
176
-			list($tos) = dbrow($query);
177
-			$output .= "<div class='tblborder' style='width: 90%; margin: 1em auto;'>$tos</div>";
178
-		}
179
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" style='margin: 0 auto;' action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
180
-		<div><label for='newpenname'>"._PENNAME.":</label>";
181
-		if((isADMIN && uLEVEL == 1) || $action == "register")
182
-			$output .= "<INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".(isset($user) ? $user['penname'] : "")."\"><INPUT name=\"oldpenname\" type=\"hidden\" value=\"".(isset($user) ? $user['penname'] : "")."\"><font color=\"red\">*</font> ";
183
-		else if(isset($user)) $output .= " ".$user['penname'];
184
-		$output .= "</div>
185
-	 	<div><label for='realname'>"._REALNAME.": </label><INPUT type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".(isset($user) ? $user['realname'] : "")."\"></div>
186
-	 	<div><label for='email'>"._EMAIL.":</label><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".(isset($user) ? $user['email'] : "")."\" maxlength=\"200\" size=\"35\"><font color=\"red\">*</font></div>
187
-	 	<div><label for='bio'>"._BIO.":</label></div>
188
-		<div style='width: 450px; margin: 0 auto;'><textarea class=\"textbox\" name=\"bio\" cols=\"50\" rows=\"6\">".(isset($user) ? stripslashes($user['bio']) : "")."</TEXTAREA></div>";
189
-/* The section adds fields to the form from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
190
-		$authorfields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
191
-		while($field = dbassoc($authorfields)) {
192
-			if($field['field_type'] == 1 || $field['field_type'] == 4 || $field['field_type'] == 6) 
193
-				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n<input type='text' class='textbox' name='af_".$field['field_name']."'".(!empty($user["af_".$field['field_id']]) ? "value='".$user["af_".$field['field_id']]."'" : "").">\n</div>\n";
194
-			if($field['field_type'] == 2) {
195
-				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n
196
-						<select class='textbox' name='af_".$field['field_name']."'>\n";
197
-				$opts = explode("|#|", $field['field_options']);
198
-				foreach($opts as $opt) {
199
-					$output .= "<option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == $opt ? " selected" : "").">$opt</option>\n";
200
-				}
201
-				$output .= "</select>\n</div>\n";
202
-			}
203
-			if($field['field_type'] == 5) eval(stripslashes($field['field_code_in']));
204
-			if($field['field_type'] == 3) {
205
-				$output .= "<div class='fieldset'><span class='label'>".$field['field_title'].":</span>\n";
206
-				$output .= "<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._YES."' value='"._YES."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _YES ? "checked='checked'" : "")."> <label for='".$field['field_name']._YES."'>"._YES."</label>\n
207
-					<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._NO."' value='"._NO."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _NO ? "checked='checked'" : "")."> <label for='".$field['field_name']._NO."'>"._NO."</label></div>\n";
208
-			}
209
-		}
210
-/* End dynamic fields */
211
-	 	if($imageupload == "1")
212
-	 		$output .= "<div><label for='image'>"._IMAGE.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"image\" maxlength=\"200\" value=\"".(!empty($user['image']) ? $user['image'] : "")."\"></div>";
213
-		if($action != "register" || $pwdsetting)
214
-	 	$output .= "<div><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\">".($action == "register" ? "<font color=\"red\">*</font>" : "")."</div>
215
-			<div><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\">".($action == "register" ? "<font color=\"red\">*</font>" : "")."</div>";
216
-		if(!empty($captcha) && $action == "register") $output .= "<div><label for='userdigit'>"._CAPTCHANOTE."</label><input MAXLENGTH=5 SIZE=5 name=\"userdigit\" type=\"text\" value=\"\"><div style='text-align: center;'><img width=120 height=40 src=\""._BASEDIR."includes/button.php\" style=\"border: 1px solid #111;\"></div></div>";
217
-	 	$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";
218
-	 	if(!isADMIN)
219
-	 	{
220
-			 	$output .= " [<a href=\"admin.php?action=deleteuser&amp;uid=$uid\">"._DELETE."</a>]";
221
-	 	}
222
-	 	$output .= "</div></form></div>".write_message("<font color=\"red\">*</font> "._REQUIREDFIELDS);
223
-	}
224
-?>
225 1
\ No newline at end of file
2
+<?php
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+if(!function_exists("random_char")) {
28
+
29
+function random_char($string)
30
+{
31
+	$length = strlen($string);
32
+	$position = mt_rand(0, $length - 1);
33
+	$output = ($string[$position]);
34
+	return $output;
35
+}
36
+
37
+function random_string ($charset_string, $length)
38
+{
39
+	$return_string = random_char($charset_string);
40
+	for ($x = 1; $x < $length; $x++)
41
+	$return_string .= random_char($charset_string);
42
+	return $return_string;
43
+}
44
+
45
+}
46
+ 
47
+	$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
48
+	if(!$uid) $uid = USERUID;
49
+
50
+	if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") $output .= write_error(_NOTAUTHORIZED);
51
+	if(isMEMBER) $output .= "<div id=\"pagetitle\">"._EDITPERSONAL."</div>";
52
+	else $output .= "<div id=\"pagetitle\">"._NEWACCOUNT."</div>";
53
+	if(!empty($_POST['submit'])) {
54
+		$penname = isset($_POST['newpenname']) ? escapestring($_POST['newpenname']) : false;
55
+		$email = escapestring($_POST['email']);
56
+		if(!isset($email) && !isADMIN) $output .= "<div style='text-align: center;'>"._EMAILREQUIRED."</div>";
57
+		else if($penname && !preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) $output .= "<div style='text-align: center;'>"._BADUSERNAME."</div>";
58
+		else if(!validEmail($email)) $output .= "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
59
+		else if($action == "register") {
60
+			if(!$penname || !preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) $output .= write_error(_PENEMAILREQUIRED);
61
+			else if($pwdsetting && empty($_POST['password'])) $output .= write_error(_PWDREQUIRED."  "._TRYAGAIN);
62
+			else  {
63
+				$result = dbquery("SELECT "._PENNAMEFIELD." FROM "._AUTHORTABLE." WHERE "._PENNAMEFIELD." = '".escapestring($penname)."'");
64
+				$result2 = dbquery("SELECT "._EMAILFIELD." as email FROM "._AUTHORTABLE." WHERE "._EMAILFIELD." = '$email'");
65
+				if($captcha && !captcha_confirm()) $output .= write_error(_CAPTCHAFAIL);
66
+				else if(dbnumrows($result) > 0) $output .= write_error(_PENNAMEINUSE."  "._TRYAGAIN);
67
+				else if(dbnumrows($result2) > 0) $output .= write_error(_EMAILINUSE."  "._TRYAGAIN);
68
+				else if(preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) {
69
+					if(!$pwdsetting) {
70
+						$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
71
+						$pass = random_string($charset, 10);
72
+						$encryppass = password_hash($pass, PASSWORD_BCRYPT, ['cost' => 12]);
73
+					}
74
+					else {
75
+						if($_POST['password'] != $_POST['password2']) {
76
+							$output .=  write_error(_PASSWORDTWICE);
77
+							$tpl->assign("output", $output);
78
+							$tpl->printToScreen( );
79
+							dbclose( );
80
+							exit( );
81
+						}
82
+						$pass = $_POST['password2'];
83
+						$encryppass = password_hash($pass, PASSWORD_BCRYPT, ['cost' => 12]);
84
+					}
85
+					dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." (penname, realname, bio, email, date, password) VALUES ('".escapestring($penname)."', '".escapestring(strip_tags($_POST['realname']))."', '".strip_tags(escapestring($_POST['bio']), $allowed_tags)."', '$email'," . time() . ", '$encryppass')");
86
+					$useruid = dbinsertid();
87
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, $useruid, $_SERVER['REMOTE_ADDR']))."', '".$useruid. "', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG', " . time() . ")");
88
+					if(empty($siteskin)) {
89
+						$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
90
+						list($skin) = dbrow($skinquery);
91
+					}
92
+					else $skin = $siteskin;
93
+
94
+
95
+
96
+					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$useruid."', '$skin', '$displayindex', '$defaultsort', '$tinyMCE')");
97
+/* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
98
+					$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
99
+					while($field = dbassoc($fields)) {
100
+						if(!$uid) continue;
101
+						$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$useruid."'");
102
+						if(dbnumrows($oldfield) > 0) {
103
+							$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring($_POST["af_".$field['field_name']]) : false;
104
+							if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='$newinfo' WHERE uid = '$useruid' AND field = '".$field['field_id']."'");
105
+							else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$useruid' AND field = '".$field['field_id']."'");
106
+						}
107
+						else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$useruid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
108
+					}
109
+/* End dynamic fields */
110
+					$subject = _SIGNUPSUBJECT;
111
+					$mailtext = _SIGNUPMESSAGE._LOGIN.": $penname\n"._PASSWORD.": $pass \n\n";
112
+					if(!$pwdsetting) $mailtext .= _SIGNUPWARNING;
113
+					include("includes/emailer.php");
114
+					sendemail($penname, $email, $sitename, $siteemail, $subject, $mailtext, "html");
115
+
116
+					/* registration notice */
117
+					if (isset($notifications))
118
+					{
119
+						$notifications = unserialize($notifications);
120
+					}
121
+
122
+					if(isset($notifications['registration_notify'])  && $notifications['registration_notify'])  {
123
+						if (isset($notifications['registration_toemail'])  && $notifications['registration_toemail'])
124
+						{
125
+							$RegSubject = "Registration Notice";
126
+							$RegIP = $_SERVER['REMOTE_ADDR'];
127
+							$RegHost = gethostbyaddr($RegIP);			
128
+							$RegNoticeTo = $notifications['registration_toemail'];
129
+							$RegMessage = "Username: $penname" . "\r\n" . "Email: $email" . "\r\n" . "IP: $RegIP" . "\r\n" . "Host: $RegHost";
130
+							$RegMessage .= " registered on your site";
131
+							$RegMessage .= "<br>Profile link: " . "<a href='" . $url . "/viewuser.php?uid=" . $useruid . "'>" . $penname . "</a>";
132
+
133
+							$RegNoticeTo_array=explode(',', $RegNoticeTo);
134
+							foreach ($RegNoticeTo_array AS $RegNoticeTo_email) {
135
+								if(validEmail($RegNoticeTo_email)) {
136
+									sendemail($sitename, $RegNoticeTo_email, $siteemail, $siteemail, $RegSubject,  $RegMessage);
137
+								}	
138
+							}
139
+
140
+						}
141
+					}
142
+					/* registration notice end */
143
+
144
+					dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET newestmember = '".$useruid."', members = members + 1");
145
+					if(defined("AUTHORPREFIX")) dbquery("UPDATE ".AUTHORPREFIX."fanfiction_stats SET newestmember = '".$useruid."', members = members + 1");
146
+					unset($_POST['submit']);
147
+					$output = write_message(_ACTIONSUCCESSFUL);
148
+					define("_LOGINCHECK", true);
149
+					include("user/login.php");
150
+				}
151
+				else $output .= _BADUSERNAME;
152
+			}
153
+		}
154
+		else{
155
+			 if(($_POST['password']) && ($_POST['password2'])) {
156
+				if($_POST['password'] == $_POST['password2']) {
157
+					$encryppassword = password_hash($_POST['password'], PASSWORD_BCRYPT, ['cost' => 12]);
158
+					dbquery("UPDATE "._AUTHORTABLE." SET password='$encryppassword' WHERE uid = '$uid'");
159
+				}
160
+				else $output .=  write_error(_PASSWORDTWICE);
161
+			}
162
+			if(isset($_POST['oldpenname']) && $penname != $_POST['oldpenname']) {
163
+				$checkresult = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE penname = '".escapestring($penname)."'");
164
+				if(dbnumrows($checkresult)) {
165
+					$output .= write_message(_PENNAMEINUSE."  "._TRYAGAIN);
166
+				}
167
+				else {
168
+					dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$_POST[uid]'");
169
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST['oldpenname'], $uid, $penname))."', '".USERUID."', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB', " . time() . ")");
170
+				}
171
+			}
172
+/* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
173
+			$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
174
+			while($field = dbassoc($fields)) {
175
+				$uid = isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : false;
176
+				if(!$uid) continue;
177
+				$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$uid."'");
178
+				if(dbnumrows($oldfield) > 0) {
179
+					$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring(descript($_POST["af_".$field['field_name']])) : false;
180
+					if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='".$newinfo."' WHERE uid = '$uid' AND field = '".descript($field['field_id'])."'");
181
+					else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid' AND field = '".$field['field_id']."'");
182
+				}
183
+				else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$uid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
184
+			}
185
+/* End dynamic fields */
186
+			dbquery("UPDATE "._AUTHORTABLE." SET realname='".descript(strip_tags(escapestring($_POST['realname'])), $allowed_tags)."', email='$email', bio='".descript(strip_tags(escapestring($_POST['bio']), $allowed_tags))."', image='".($imageupload && !empty($_POST['image']) ? escapestring($_POST['image']) : "")."' WHERE uid = '$uid'");
187
+			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT." "._LOGINAGAIN));
188
+		}
189
+	}
190
+	else {
191
+		if($action != "register") {
192
+			$result = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
193
+			$user = dbassoc($result);
194
+			$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
195
+			while($field = dbassoc($result2)) {
196
+				$user["af_".$field['field']] = $field['info'];
197
+			}
198
+		}
199
+		if($action == "register") {
200
+			$query = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'tos'");
201
+			list($tos) = dbrow($query);
202
+			$output .= "<div class='tblborder' style='width: 90%; margin: 1em auto;'>$tos</div>";
203
+		}
204
+		$output .= "<div id='settingsform'><form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='width: 260%; margin: 0 auto;' action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
205
+		<div><label for='newpenname'>"._PENNAME.":</label>";
206
+		if((isADMIN && uLEVEL == 1) || $action == "register")
207
+			$output .= "<INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".(isset($user) ? $user['penname'] : "")."\"><INPUT name=\"oldpenname\" type=\"hidden\" value=\"".(isset($user) ? $user['penname'] : "")."\"><font color=\"red\">*</font> ";
208
+		else if(isset($user)) $output .= " ".$user['penname'];
209
+		
210
+		$output .= "</div>
211
+	 	<div><label for='realname'>"._REALNAME.": </label><INPUT type=\"text\" class=\"textbox=\" name=\"realname\" maxlength=\"200\" value=\"".(isset($user) ? $user['realname'] : "")."\"></div>
212
+	 	<div><label for='email'>"._EMAIL.":</label><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".(isset($user) ? $user['email'] : "")."\" maxlength=\"200\" size=\"35\"><font color=\"red\">*</font></div>
213
+	 	<div><label for='bio'>"._BIO.":</label></div>
214
+		<div style='width: 450px; margin: 0 auto;'>
215
+		  <textarea class=\"textbox\" name=\"bio\" cols=\"50\" rows=\"6\">".(isset($user['bio']) ? stripslashes($user['bio']) : "")."</TEXTAREA></div>";
216
+/* The section adds fields to the form from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
217
+		$authorfields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
218
+		while($field = dbassoc($authorfields)) {
219
+			if($field['field_type'] == 1 || $field['field_type'] == 4 || $field['field_type'] == 6) 
220
+				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n<input type='text' class='textbox' name='af_".$field['field_name']."'".(!empty($user["af_".$field['field_id']]) ? "value='".$user["af_".$field['field_id']]."'" : "").">\n</div>\n";
221
+			if($field['field_type'] == 2) {
222
+				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n
223
+						<select class='textbox' name='af_".$field['field_name']."'>\n";
224
+				$opts = explode("|#|", $field['field_options']);
225
+				foreach($opts as $opt) {
226
+					$output .= "<option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == $opt ? " selected" : "").">$opt</option>\n";
227
+				}
228
+				$output .= "</select>\n</div>\n";
229
+			}
230
+			if($field['field_type'] == 5) eval(stripslashes($field['field_code_in']));
231
+			if($field['field_type'] == 3) {
232
+				$output .= "<div class='fieldset'><span class='label'>".$field['field_title'].":</span>\n";
233
+				$output .= "<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._YES."' value='"._YES."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _YES ? "checked='checked'" : "")."> <label for='".$field['field_name']._YES."'>"._YES."</label>\n
234
+					<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._NO."' value='"._NO."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _NO ? "checked='checked'" : "")."> <label for='".$field['field_name']._NO."'>"._NO."</label></div>\n";
235
+			}
236
+		}
237
+/* End dynamic fields */
238
+	 	if($imageupload == "1")
239
+	 		$output .= "<div><label for='image'>"._IMAGE.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"image\" maxlength=\"200\" value=\"".(!empty($user['image']) ? $user['image'] : "")."\"></div>";
240
+		if($action != "register" || $pwdsetting)
241
+	 	$output .= "<div><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\">".($action == "register" ? "<font color=\"red\">*</font>" : "")."</div>
242
+			<div><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\">".($action == "register" ? "<font color=\"red\">*</font>" : "")."</div>";
243
+		if(!empty($captcha) && $action == "register") $output .= "<div><label for='userdigit'>"._CAPTCHANOTE."</label><input MAXLENGTH=5 SIZE=5 name=\"userdigit\" type=\"text\" value=\"\"><div style='text-align: center;'><img width=240 height=60 src=\""._BASEDIR."includes/button.php\" style=\"border: 1px solid #111;\"></div></div>";
244
+	 	$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";
245
+	 	if(!isADMIN && $action != "register")
246
+	 	{
247
+			 	$output .= " [<a href=\"admin.php?action=members&delete=$uid\">"._DELETE."</a>]";
248
+	 	}
249
+	 	$output .= "</div></form></div>".write_message("<font color=\"red\">*</font> "._REQUIREDFIELDS);
250
+	}
251
+?>
... ...
@@ -1,65 +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
-		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
34
-		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
35
-		else $siteskin = $defaultskin;
36
-		define("uLEVEL", $userdata['level']);
37
-		define("isADMIN", uLEVEL > 0 ? true : false);
38
-		define("isMEMBER", true);
39
-		if(!isset($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
40
-		else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
41
-	}
42
-}
43
-if(!empty($_SESSION[$sitekey."_useruid"]) && !defined("USERUID")) {
44
-	$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"]."'"));
45
-	if($userdata && $userdata['level'] != -1 && $_SESSION[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
46
-		define("USERUID", $userdata['uid']);
47
-		define("USERPENNAME", $userdata['penname']);
48
-		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
49
-		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
50
-		else $siteskin = $defaultskin;
51
-		define("uLEVEL", $userdata['level']);
52
-		define("isADMIN", uLEVEL > 0 ? true : false);
53
-		define("isMEMBER", true);
54
-		if(!isset($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
55
-		else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
56
-	}
57
-}
58
-if(!defined("USERUID")) define("USERUID", false);
59
-if(!defined("USERPENNAME")) define("USERPENNAME", false);
60
-if(!defined("uLEVEL")) define("uLEVEL", 0);
61
-if(!defined("isMEMBER")) define("isMEMBER", false);
62
-if(!defined("isADMIN")) define("isADMIN", false);
63
-if(empty($siteskin)) $siteskin = $defaultskin;
64
-
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
+
65 69
 ?>
66 70
\ No newline at end of file
... ...
@@ -1,87 +1,136 @@
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("_LOGINCHECK")) exit( );
26
-	if(isset($_POST['submit']) && preg_match("!^[a-z0-9_ ]{3,30}$!i", $_POST['penname'])) {
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
-		include_once("includes/queries.php");
32
-		$result = dbquery("SELECT *, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs AS ap ON ap.uid = "._UIDFIELD." WHERE "._PENNAMEFIELD." = '".$_POST['penname']."'");
33
-		$passwd = dbassoc($result);
34
-		if($maintenance && $passwd['level'] < 0) {
35
-			header("Location: maintenance.php");
36
-			exit( );
37
-		}
38
-		$encryptedpassword = md5($_POST['password']);
39
-		if($passwd['level'] == -1) {
40
-			require_once("header.php");
41
-			//make a new TemplatePower object
42
-			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
43
-			else $tpl = new TemplatePower("default_tpls/default.tpl");
44
-			include_once("includes/corefunctions.php");
45
-			accessDenied( );
46
-		}
47
-		if(isset($_POST['cookiecheck'])) {
48
-			setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
49
-			setcookie($sitekey."_salt", md5($passwd['email']+$encryptedpassword),  time()+60*60*24*30, "/");
50
-		}
51
-		if($passwd['password'] == $encryptedpassword) {
52
-			if(!isset($_SESSION)) session_start( );
53
-			$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
54
-			$_SESSION[$sitekey."_salt"] = md5($passwd['email']+$encryptedpassword);
55
-		}
56
-
57
-		else { 
58
-			require_once("header.php");
59
-			//make a new TemplatePower object
60
-			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
61
-			else $tpl = new TemplatePower("default_tpls/default.tpl");
62
-			include_once("includes/pagesetup.php");
63
-			$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
64
-			$output .= "<div style='text-align: center;'>"._WRONGPASSWORD."</div>";
65
-			$tpl->assign("output", $output);
66
-			$tpl->printToScreen( );
67
-			dbclose( );
68
-			exit( );
69
-		}
70
-	}
71
-	else if(!isMEMBER) {
72
-		$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
73
-		$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'] : "")."\">
74
-		<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 />
75
-		<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 />
76
-		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck\">"._REMEMBERME."</label><br />
77
-		<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">
78
-		</form></div>";
79
-		$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = 'login' OR link_name = 'lostpassword'");
80
-		while($link = dbassoc($linkquery)) {
81
-			if($link['link_access'] && !isMEMBER) continue;
82
-			if($link['link_access'] == 2 && !isADMIN) continue;
83
-			$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>");
84
-		}
85
-		$output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>";
86
-	}
87
-?>
88 1
\ No newline at end of file
2
+<?php
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+	if(isset($_POST['submit']) && preg_match("!^[-a-z0-9_ ]{3,30}$!i", $_POST['penname'])) {
27
+		if(!defined("_LOGINCHECK")) exit( );
28
+		define("_BASEDIR", "");
29
+		include_once("config.php");
30
+		$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
31
+		list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings);
32
+		$tempdebug = $debug;
33
+		$debug = 0;
34
+		define("TABLEPREFIX", $tableprefix);
35
+		define("SITEKEY", $sitekey);
36
+		include_once("includes/queries.php");
37
+		$result = dbquery("SELECT *, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs AS ap ON ap.uid = "._UIDFIELD." WHERE "._PENNAMEFIELD." = '".$_POST['penname']."'");
38
+		$passwd = dbassoc($result);
39
+		if(!dbnumrows($result)) {
40
+			require_once("header.php");
41
+			//make a new TemplatePower object
42
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
43
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
44
+			include_once("includes/pagesetup.php");
45
+			$output = write_error(_NOSUCHACCOUNT);
46
+			$tpl->assign("output", $output);
47
+			$tpl->printToScreen( );
48
+			dbclose( );
49
+			exit( );
50
+		}
51
+		if($maintenance && $passwd['level'] < 0) {
52
+			header("Location: maintenance.php");
53
+			exit( );
54
+		}
55
+		$encryptedpasswordb = $passwd['password'];
56
+		$encryptedpasswordm = md5($_POST['password']);
57
+		if($passwd['level'] == -1) {
58
+			require_once("header.php");
59
+			//make a new TemplatePower object
60
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
61
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
62
+			include_once("includes/pagesetup.php");
63
+			$output = write_error(_ACCOUNTLOCKED);
64
+			$tpl->assign("output", $output);
65
+			$tpl->printToScreen( );
66
+			dbclose( );
67
+			exit( );
68
+		}
69
+		if(password_verify($_POST['password'], $encryptedpasswordb) == $encryptedpasswordb) {
70
+			if(isset($_POST['cookiecheck'])) {
71
+				setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
72
+				setcookie($sitekey."_salt", md5($passwd['email'] . $encryptedpasswordb),  time()+60*60*24*30, "/");
73
+			}
74
+			if(!isset($_SESSION)) session_start( );
75
+			$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
76
+			$_SESSION[$sitekey."_salt"] = md5($passwd['email'] . $encryptedpasswordb);
77
+			$logincode = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'login'");
78
+			while($code = dbassoc($logincode)) {
79
+				eval($code['code_text']);
80
+			}
81
+		}
82
+
83
+		else if($passwd['password'] == $encryptedpasswordm) {
84
+			if(isset($_POST['cookiecheck'])) {
85
+				setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
86
+				setcookie($sitekey."_salt", md5($passwd['email'] . $encryptedpasswordm),  time()+60*60*24*30, "/");
87
+			}
88
+			if(!isset($_SESSION)) session_start( );
89
+			$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
90
+			$_SESSION[$sitekey."_salt"] = md5($passwd['email'] . $encryptedpasswordm);
91
+			$logincode = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'login'");
92
+			while($code = dbassoc($logincode)) {
93
+				eval($code['code_text']);
94
+			}
95
+		}
96
+
97
+		else { 
98
+			require_once("header.php");
99
+			//make a new TemplatePower object
100
+			if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
101
+			else $tpl = new TemplatePower("default_tpls/default.tpl");
102
+			include_once("includes/pagesetup.php");
103
+			$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
104
+			$output .= "<div style='text-align: center;'>"._WRONGPASSWORD."</div>";
105
+			$tpl->assign("output", $output);
106
+			$tpl->printToScreen( );
107
+			dbclose( );
108
+			exit( );
109
+		}
110
+		$debug = $tempdebug;
111
+	}
112
+	else {
113
+		require_once("header.php");
114
+		if(!isMEMBER) {
115
+		
116
+		$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
117
+		$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'] : "")."\">
118
+		<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 />
119
+		<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 />
120
+		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck\">"._REMEMBERME."</label><br />
121
+		<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">
122
+		</form></div>";
123
+		$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = 'login' OR link_name = 'lostpassword'");
124
+		while($link = dbassoc($linkquery)) {
125
+			if($link['link_access'] && !isMEMBER) continue;
126
+			if($link['link_access'] == 2 && !isADMIN) continue;
127
+			$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>");
128
+		}
129
+		$output .= "<div style='text-align: center;'>";
130
+		if(isset($pagelinks['register'])) {
131
+			$output .= $pagelinks['register']['link']." | ";
132
+		}
133
+		$output .= $pagelinks['lostpassword']['link']."</div>";
134
+		 
135
+	}
136
+}
137
+?>
... ...
@@ -1,33 +1,33 @@
1
-<?php
2
-if(!defined("_LOGOUTCHECK")) exit( );
3
-	define("_BASEDIR", "");
4
-	include("config.php");
5
-	include("includes/queries.php");
6
-	session_start( );
7
-	foreach ($_SESSION as $VarName => $Value)  { 
8
-		if(substr($VarName, 0, strlen($sitekey)) == $sitekey) {
9
-			if(strpos($VarName, "skin")) continue;
10
-			$_SESSION[$VarName] = "";
11
-			unset($_SESSION[$VarName]);
12
-			unset($_COOKIE[$VarName]);
13
-			setcookie($VarName, '', time() - 1000, '/', '', '' );
14
-		}
15
-	} 
16
-	foreach ($_COOKIE as $VarName => $Value)  { 
17
-		if(substr($VarName, 0, strlen($sitekey)) == $sitekey) {
18
-			unset($_COOKIE[$VarName]);
19
-			setcookie($VarName, "", time() - 1000, '/', '', '' );
20
-		}
21
-	} 
22
-require_once("header.php");
23
-//make a new TemplatePower object
24
-if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
25
-else $tpl = new TemplatePower("default_tpls/default.tpl");
26
-if(file_exists("$skindir/listings.tpl")) $tpl->assignInclude( "listings", "./$skindir/listings.tpl" );
27
-else $tpl->assignInclude( "listings", "./default_tpls/listings.tpl" );
28
-include("includes/pagesetup.php");
29
-
30
-$output .= write_message(_ACTIONSUCCESSFUL);
31
-$tpl->assign("output", $output);
32
-$tpl->printToScreen( );
1
+<?php
2
+if(!defined("_LOGOUTCHECK")) exit( );
3
+	define("_BASEDIR", "");
4
+	include("config.php");
5
+	session_start( );
6
+	foreach ($_SESSION as $VarName => $Value)  { 
7
+		if(substr($VarName, 0, strlen($sitekey)) == $sitekey) {
8
+			if(strpos($VarName, "skin")) continue;
9
+			$_SESSION[$VarName] = "";
10
+			unset($_SESSION[$VarName]);
11
+			unset($_COOKIE[$VarName]);
12
+			setcookie($VarName, '', time() - 1000, '/', '', '' );
13
+		}
14
+	} 
15
+	foreach ($_COOKIE as $VarName => $Value)  { 
16
+		if(substr($VarName, 0, strlen($sitekey)) == $sitekey) {
17
+			unset($_COOKIE[$VarName]);
18
+			setcookie($VarName, "", time() - 1000, '/', '', '' );
19
+		}
20
+	} 
21
+require_once("header.php");
22
+//make a new TemplatePower object
23
+if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
24
+else $tpl = new TemplatePower("default_tpls/default.tpl");
25
+if(file_exists("$skindir/listings.tpl")) $tpl->assignInclude( "listings", "./$skindir/listings.tpl" );
26
+else $tpl->assignInclude( "listings", "./default_tpls/listings.tpl" );
27
+include("includes/pagesetup.php");
28
+
29
+$output .= write_message(_ACTIONSUCCESSFUL);
30
+$tpl->assign("output", $output);
31
+$tpl->printToScreen( );
32
+exit( );
33 33
 ?>
34 34
\ No newline at end of file
... ...
@@ -1,80 +1,114 @@
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
-if(!function_exists("random_char")) {
27
-
28
-function random_char($string)
29
-{
30
-	$length = strlen($string);
31
-	$position = mt_rand(0, $length - 1);
32
-	return ($string[$position]);
33
-}
34
-
35
-function random_string ($charset_string, $length)
36
-{
37
-	$return_string = random_char($charset_string);
38
-	for ($x = 1; $x < $length; $x++)
39
-	$return_string .= random_char($charset_string);
40
-	return $return_string;
41
-}
42
-
43
-}
44
-if($loggedin) accessDenied( );
45
-	$output = "<div id=\"pagetitle\">"._LOSTPASSWORD."</div>";
46
-
47
-	  if(isset($_POST['submit'])) {
48
-		  $result = dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE email = '$_POST[email]'");
49
-		  list($uid, $penname) = dbrow($result);
50
-		  if(dbnumrows($result) == 0) $output .= write_message(_BADEMAIL);
51
-		  else {
52
-			include("includes/emailer.php");
53
-			mt_srand((double)microtime() * 1000000);
54
-			$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';		
55
-			$pass = random_string($charset, 10);
56
-			$encryppass = md5($pass);
57
-			$subject = _NEWPWDSUB;
58
-			$mailtext = sprintf(_NEWPWDMSG, $pass);
59
-
60
-		
61
-			$result = sendemail($penname, $_POST['email'], $sitename, $siteemail, $subject, $mailtext, "html");
62
-			if($result) {
63
-				$output .= write_message(_PASSWORDSENT);
64
-				dbquery("UPDATE "._AUTHORTABLE." SET password='$encryppass' WHERE uid = '".$uid."'");
65
-			}
66
-			else $output .=  write_message(_EMAILFAILED);
67
-			if($logging) 
68
-				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_LOST_PASSWORD, $penname, $uid, ($result ? _YES : _NO)))."', '$uid', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'LP')");
69
-
70
-		}
71
-	}
72
-	else {
73
-		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=lostpassword\">
74
-		<table align=\"center\" width=\"300\">
75
-		<tr><td>"._ENTEREMAIL."</td></tr>
76
-		<tr><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\"> <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>
77
-		</td></tr></table>";
78
-	}
79
-
80
-?>
81 1
\ No newline at end of file
2
+<?php
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+if(!function_exists("random_char")) {
28
+
29
+function random_char($string)
30
+{
31
+	$length = strlen($string);
32
+	$position = mt_rand(0, $length - 1);
33
+	return ($string[$position]);
34
+}
35
+
36
+function random_string ($charset_string, $length)
37
+{
38
+	$return_string = random_char($charset_string);
39
+	for ($x = 1; $x < $length; $x++)
40
+	$return_string .= random_char($charset_string);
41
+	return $return_string;
42
+}
43
+
44
+}
45
+if(isMEMBER) accessDenied( );
46
+	$output = "<div id=\"pagetitle\">"._LOSTPASSWORD."</div>";
47
+
48
+	  if(isset($_POST['submit'])) {
49
+		if(validEmail($_POST['email'])) {
50
+			$result = dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." AS email FROM "._AUTHORTABLE." WHERE email = '".strtolower(escapestring(descript($_POST['email'])))."'");
51
+			list($uid, $penname, $email) = dbrow($result);
52
+			if(dbnumrows($result) == 0) $output .= write_message(_BADEMAIL);
53
+			else {
54
+				include("includes/emailer.php");
55
+				mt_srand((double)microtime() * 1000000);
56
+				$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';		
57
+				$pass = random_string($charset, 10);
58
+				$encryppass = password_hash($_POST['password'], PASSWORD_BCRYPT, ['cost' => 12]);
59
+				$subject = _NEWPWDSUB;
60
+				$mailtext = sprintf(_NEWPWDMSG, $pass);
61
+
62
+		
63
+				$result = sendemail($penname, $email, $sitename, $siteemail, $subject, $mailtext, "html");
64
+				if($result) {
65
+					$output .= write_message(_PASSWORDSENT);
66
+					dbquery("UPDATE ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." SET password='$encryppass' WHERE uid = '".$uid."'");
67
+				}
68
+				else $output .=  write_message(_EMAILFAILED);
69
+				if($logging) 
70
+					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_LOST_PASSWORD, $penname, $uid, ($result ? _YES : _NO)))."', '$uid', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'LP', " . time() . ")");
71
+
72
+
73
+				/* lost password notice */
74
+				if (isset($notifications))
75
+				{
76
+					$notifications = unserialize($notifications);
77
+				}
78
+	 
79
+				if (isset($notifications['lostpassword_notify'])  && $notifications['lostpassword_notify'])
80
+				{
81
+				
82
+					if (isset($notifications['registration_toemail'])  && $notifications['registration_toemail'])
83
+					{
84
+						$RegSubject = "Lost Password Notice";
85
+						$RegIP = $_SERVER['REMOTE_ADDR'];
86
+						$RegHost = gethostbyaddr($RegIP);
87
+						$RegNoticeTo = $notifications['registration_toemail'];
88
+						$RegMessage = "Username: $penname" . "\r\n" . "Email: $email" . "\r\n" . "IP: $RegIP" . "\r\n" . "Host: $RegHost";
89
+						$RegMessage .= " Asked for new password";
90
+						$RegMessage .= "<br>Profile link: " . "<a href='".$url."/viewuser.php?uid=" . $uid . "'>" . $penname . "</a>";
91
+
92
+						$RegNoticeTo_array = explode(',', $RegNoticeTo);
93
+						foreach ($RegNoticeTo_array as $RegNoticeTo_email)
94
+						{
95
+							if (validEmail($RegNoticeTo_email))
96
+							{
97
+								sendemail($sitename, $RegNoticeTo_email, $siteemail, $siteemail, $RegSubject,  $RegMessage);
98
+							}
99
+						}
100
+					}
101
+				}	 
102
+			}
103
+
104
+		}
105
+		else $output .= write_message(_BADEMAIL);
106
+	}
107
+	else {
108
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=lostpassword\">
109
+		<table align=\"center\" width=\"300\">
110
+		<tr><td>"._ENTEREMAIL."</td></tr>
111
+		<tr><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\"> <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>
112
+		</td></tr></table>";
113
+	}
114
+
115
+?>
... ...
@@ -1,86 +1,94 @@
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
-
27
-// Build the user's profile information
28
-$tpl->newBlock("profile");
29
-$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
30
-$userinfo = dbassoc($result2);
31
-$nameinfo = "";
32
-if($userinfo['email'])
33
-	$nameinfo .= " [<a href=\"viewuser.php?action=contact&amp;uid=".$userinfo['uid']."\">"._CONTACT."</a>]";
34
-if(!empty($favorites) && $loggedin && $userinfo['uid'] != USERUID) {
35
-	$fav = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'AU' AND item = '".$userinfo['uid']."'");
36
-	if(dbnumrows($fav) == 0) $nameinfo .= " [<a href=\"user.php?uid=USERUID&amp;action=favau&amp;author=".$userinfo['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
37
-}
38
-$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
39
-$tpl->assign("membersince", date("$dateformat", $userinfo['date']));
40
-if($userinfo['realname'])
41
-	$tpl->assign("realname", $userinfo['realname']);
42
-if($userinfo['bio']) {
43
-	$bio = nl2br($userinfo['bio']);	
44
-	$tpl->assign("bio", stripslashes($bio));
45
-}
46
-if($userinfo['image'])
47
-	$tpl->assign("image", "<img src=\"".$userinfo['image']."\">");
48
-$tpl->assign("userlevel", isset($userinfo['level']) && $userinfo['level'] > 0 && $userinfo['level'] < 4 ? _ADMINISTRATOR.(isADMIN ? " - ".$userinfo['level'] : "") : _MEMBER);
49
-/* Dynamic authorinfo fields */
50
-$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
51
-$dynamicfields = "";
52
-while($field = dbassoc($result2)) {
53
-	if($field['info'] == "") continue;
54
-	$fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$field['field']."' LIMIT 1"));
55
-	if($fieldinfo) {
56
-		$thisfield = "";
57
-		if($fieldinfo['field_on'] == 0) continue;
58
-		if($fieldinfo['field_type'] == 1) { $thisfield = format_link($field['info']);
59
-		}
60
-		if($fieldinfo['field_type'] == 4) {
61
-			$thisfield = preg_replace("@\{info\}@", $field['info'], $fieldinfo['field_options']);
62
-			$thisfield = format_link($thisfield);
63
-		}
64
-		if($fieldinfo['field_type'] == 2 || $fieldinfo['field_type'] == 6) {
65
-			$thisfield = stripslashes($field['info']);
66
-		}
67
-		if($fieldinfo['field_type'] == 3) {
68
-			$thisfield = $field['info'];
69
-		}
70
-		else eval($fieldinfo['field_code_out']);
71
-		$tpl->assign($fieldinfo['field_name'], $thisfield);
72
-		$dynamicfields .= "<div class='authorfields'><span class='label'>".$fieldinfo['field_title'].":</span> ".$thisfield."</div>";
73
-	}
74
-}
75
-if(!empty($dynamicfields)) $tpl->assign("authorfields", $dynamicfields);
76
-$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=viewuser.php?uid=".$uid."\">"._REPORTTHIS."</a>]");
77
-/* End dynamic fields */
78
-$adminopts = "";
79
-if(isADMIN && uLEVEL < 3) {
80
-	$adminopts .= "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"user.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
81
-	$adminopts .= " [<a href=\"admin.php?action=members&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
82
-	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
83
-	$tpl->assign("adminoptions", $adminopts);
84
-}
85
-$tpl->gotoBlock("_ROOT");
86
-?>
87 1
\ No newline at end of file
2
+<?php
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+
28
+// Build the user's profile information
29
+$tpl->newBlock("profile");
30
+$result2 = dbquery("SELECT *, date as date FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
31
+$userinfo = dbassoc($result2);
32
+$nameinfo = "";
33
+if($userinfo['email'])
34
+	$nameinfo .= " [<a href=\"viewuser.php?action=contact&amp;uid=".$userinfo['uid']."\">"._CONTACT."</a>]";
35
+if(!empty($favorites) && isMEMBER && $userinfo['uid'] != USERUID) {
36
+	$fav = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'AU' AND item = '".$userinfo['uid']."'");
37
+	if(dbnumrows($fav) == 0) $nameinfo .= " [<a href=\"user.php?action=favau&amp;uid=".USERUID."&amp;add=".$userinfo['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
38
+}
39
+ 
40
+$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
41
+$tpl->assign("membersince", date("$dateformat", $userinfo['date']));
42
+
43
+if($userinfo['realname'])
44
+	$tpl->assign("realname", $userinfo['realname']);
45
+if($userinfo['bio']) {
46
+	$bio = nl2br($userinfo['bio']);	
47
+	$tpl->assign("bio", stripslashes($bio));
48
+}
49
+if($userinfo['image'])
50
+	$tpl->assign("image", "<img src=\"".$userinfo['image']."\">");
51
+
52
+$tpl->assign("userlevel", isset($userinfo['level']) && $userinfo['level'] > 0 && $userinfo['level'] < 4 ? _ADMINISTRATOR.(isADMIN ? " - ".$userinfo['level'] : "") : _MEMBER);
53
+
54
+/* Dynamic authorinfo fields */
55
+$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
56
+$dynamicfields = "";
57
+while($field = dbassoc($result2)) {
58
+	if($field['info'] == "") continue;
59
+	$fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$field['field']."' LIMIT 1"));
60
+	if($fieldinfo) {
61
+		$thisfield = "";
62
+		if($fieldinfo['field_on'] == 0) continue;
63
+		if($fieldinfo['field_type'] == 1) { $thisfield = format_link($field['info']);
64
+		}
65
+		if($fieldinfo['field_type'] == 4) {
66
+			$thisfield = preg_replace("@\{info\}@", $field['info'], $fieldinfo['field_options']);
67
+			$thisfield = format_link($thisfield);
68
+		}
69
+		if($fieldinfo['field_type'] == 2 || $fieldinfo['field_type'] == 6) {
70
+			$thisfield = stripslashes($field['info']);
71
+		}
72
+		if($fieldinfo['field_type'] == 3) {
73
+			$thisfield = $field['info'];
74
+		}
75
+		else eval($fieldinfo['field_code_out']);
76
+		$tpl->assign($fieldinfo['field_name'], $thisfield);
77
+		$dynamicfields .= "<div class='authorfields'><span class='label'>".$fieldinfo['field_title'].":</span> ".$thisfield."</div>";
78
+	}
79
+}
80
+$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'userprofile'");
81
+while($code = dbassoc($codequery)) {
82
+	eval($code['code_text']);
83
+}
84
+if(!empty($dynamicfields)) $tpl->assign("authorfields", $dynamicfields);
85
+/* End dynamic fields */
86
+$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=viewuser.php?uid=".$uid."\">"._REPORTTHIS."</a>]");
87
+$adminopts = "";
88
+if(isADMIN && uLEVEL < 3) {
89
+	$adminopts .= "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"user.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
90
+	$adminopts .= " [<a href=\"admin.php?action=members&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
91
+	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
92
+	$tpl->assign("adminoptions", $adminopts);
93
+}
94
+$tpl->gotoBlock("_ROOT");
95
+?>
... ...
@@ -1,17 +1,17 @@
1
-<?php
2
-
3
-// Default query strings used throughout the script.  You may need to alter these to bridge to other scripts or databases.
4
-
5
-define ("_UIDFIELD", "author.uid");  // Do not change the aliasing (the "author." part)!
6
-define ("_PENNAMEFIELD", "author.penname");  // Do not change the aliasing (the "author." part)!
7
-define ("_EMAILFIELD", "author.email");  // Do not change the aliasing (the "author." part)!
8
-define ("_PASSWORDFIELD", "author.password"); //  Do not change the aliasing (the "author." part)!
9
-define ("_AUTHORTABLE", $tableprefix."fanfiction_authors as author"); // Do not change the aliasing (the "as author" part)!
10
-
11
-define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".$tableprefix."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
12
-define ("_STORYCOUNT", "SELECT count(sid) FROM ".$tableprefix."fanfiction_stories as stories WHERE validated > 0");
13
-define ("_SERIESQUERY", "SELECT series.*, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".$tableprefix."fanfiction_series as series WHERE "._UIDFIELD." = series.uid ");
14
-define ("_SERIESCOUNT", "SELECT COUNT(seriesid) FROM ".$tableprefix."fanfiction_series as series ");
15
-define ("_MEMBERLIST", "SELECT count( stories.sid ) as stories, "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs AS ap ON "._UIDFIELD." = ap.uid LEFT JOIN ".$tableprefix."fanfiction_stories AS stories ON stories.validated > 0 AND (FIND_IN_SET("._UIDFIELD.", stories.coauthors) > 0 OR stories.uid = "._UIDFIELD.") ");
16
-define ("_MEMBERCOUNT", "SELECT COUNT(DISTINCT "._UIDFIELD.") FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_stories as stories ON stories.validated > 0 AND (FIND_IN_SET("._UIDFIELD.", stories.coauthors) > 0 OR stories.uid = "._UIDFIELD.")  LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON "._UIDFIELD." = ap.uid");
1
+<?php
2
+
3
+// Default query strings used throughout the script.  You may need to alter these to bridge to other scripts or databases.
4
+
5
+define ("_UIDFIELD", "author.uid");  // Do not change the aliasing (the "author." part)!
6
+define ("_PENNAMEFIELD", "author.penname");  // Do not change the aliasing (the "author." part)!
7
+define ("_EMAILFIELD", "author.email");  // Do not change the aliasing (the "author." part)!
8
+define ("_PASSWORDFIELD", "author.password"); //  Do not change the aliasing (the "author." part)!
9
+define ("_AUTHORTABLE", TABLEPREFIX."fanfiction_authors as author"); // Do not change the aliasing (the "as author" part)!
10
+
11
+define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
12
+define ("_STORYCOUNT", "SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_stories as stories WHERE validated > 0");
13
+define ("_SERIESQUERY", "SELECT series.*, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_series as series WHERE "._UIDFIELD." = series.uid ");
14
+define ("_SERIESCOUNT", "SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series as series ");
15
+define ("_MEMBERLIST", "SELECT count( stories.sid ) as stories, "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON "._UIDFIELD." = ap.uid LEFT JOIN ".TABLEPREFIX."fanfiction_stories AS stories ON stories.validated > 0 AND (FIND_IN_SET("._UIDFIELD.", stories.coauthors) > 0 OR stories.uid = "._UIDFIELD.") ");
16
+define ("_MEMBERCOUNT", "SELECT COUNT(DISTINCT "._UIDFIELD.") FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_stories as stories ON stories.validated > 0 AND (FIND_IN_SET("._UIDFIELD.", stories.coauthors) > 0 OR stories.uid = "._UIDFIELD.")  LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON "._UIDFIELD." = ap.uid");
17 17
 ?>
18 18
\ No newline at end of file
... ...
@@ -1,28 +1,39 @@
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
-
27
-include("user/editbio.php");
28
-?>
29 1
\ No newline at end of file
2
+<?php
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+
28
+// This is to show the registration page as admin regardless of the registration setting
29
+// for the Page Links section in the Admin Panel
30
+
31
+if((isADMIN && uLEVEL == 1) && (isset($setreg) && $setreg == 0)) {
32
+    include ("user/editbio.php");
33
+}
34
+
35
+else if ((!isADMIN && uLEVEL != 1) && (isset($setreg) && $setreg == 0)) {
36
+    $output .= "<div align='center' style='margin-top: 1em;'>"._REGDISABLED."</div>";
37
+}
38
+
39
+else include("user/editbio.php");
40
+?>
... ...
@@ -53,9 +53,9 @@ function random_string ($charset_string, $length)
53 53
 		$email = escapestring($_POST['email']);
54 54
 		if(!isset($email) && !isADMIN) $output .= "<div style='text-align: center;'>"._EMAILREQUIRED."</div>";
55 55
 		else if($penname && !preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) $output .= "<div style='text-align: center;'>"._BADUSERNAME."</div>";
56
-		else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) $output .= "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
56
+		else if(!validEmail($email)) $output .= "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
57 57
 		else if($action == "register") {
58
-			if(!$penname || empty($email) || !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) || !preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) $output .= write_error(_PENEMAILREQUIRED);
58
+			if(!$penname || !preg_match("!^[a-z0-9-_ ]{3,30}$!i", $penname)) $output .= write_error(_PENEMAILREQUIRED);
59 59
 			else if($pwdsetting && empty($_POST['password'])) $output .= write_error(_PWDREQUIRED."  "._TRYAGAIN);
60 60
 			else  {
61 61
 				$result = dbquery("SELECT "._PENNAMEFIELD." FROM "._AUTHORTABLE." WHERE "._PENNAMEFIELD." = '".escapestring($penname)."'");
... ...
@@ -67,7 +67,7 @@ function random_string ($charset_string, $length)
67 67
 					if(!$pwdsetting) {
68 68
 						$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
69 69
 						$pass = random_string($charset, 10);
70
-						$encryppass = md5($pass);
70
+						$encryppass = password_hash($pass, PASSWORD_BCRYPT, ['cost' => 12]);
71 71
 					}
72 72
 					else {
73 73
 						if($_POST['password'] != $_POST['password2']) {
... ...
@@ -78,11 +78,11 @@ function random_string ($charset_string, $length)
78 78
 							exit( );
79 79
 						}
80 80
 						$pass = $_POST['password2'];
81
-						$encryppass = md5($pass);
81
+						$encryppass = password_hash($pass, PASSWORD_BCRYPT, ['cost' => 12]);
82 82
 					}
83
-					dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." (penname, realname, bio, email, date, password) VALUES ('".escapestring($penname)."', '".escapestring(strip_tags($_POST['realname']))."', '".strip_tags(escapestring($_POST['bio']), $allowed_tags)."', '$email', now(), '$encryppass')");
83
+					dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." (penname, realname, bio, email, date, password) VALUES ('".escapestring($penname)."', '".escapestring(strip_tags($_POST['realname']))."', '".strip_tags(escapestring($_POST['bio']), $allowed_tags)."', '$email'," . time() . ", '$encryppass')");
84 84
 					$useruid = dbinsertid();
85
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, $useruid, $_SERVER['REMOTE_ADDR']))."', '".$useruid."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG')");
85
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, $useruid, $_SERVER['REMOTE_ADDR']))."', '".$useruid. "', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG', " . time() . ")");
86 86
 					if(empty($siteskin)) {
87 87
 						$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
88 88
 						list($skin) = dbrow($skinquery);
... ...
@@ -108,6 +108,35 @@ function random_string ($charset_string, $length)
108 108
 					if(!$pwdsetting) $mailtext .= _SIGNUPWARNING;
109 109
 					include("includes/emailer.php");
110 110
 					sendemail($penname, $email, $sitename, $siteemail, $subject, $mailtext, "html");
111
+
112
+					/* registration notice */
113
+					if (isset($notifications))
114
+					{
115
+						$notifications = unserialize($notifications);
116
+					}
117
+
118
+					if(isset($notifications['registration_notify'])  && $notifications['registration_notify'])  {
119
+						if (isset($notifications['registration_toemail'])  && $notifications['registration_toemail'])
120
+						{
121
+							$RegSubject = "Registration Notice";
122
+							$RegIP = $_SERVER['REMOTE_ADDR'];
123
+							$RegHost = gethostbyaddr($RegIP);
124
+							$RegNoticeTo = $notifications['registration_toemail'];
125
+							$RegMessage = "Username: $penname" . "\r\n" . "Email: $email" . "\r\n" . "IP: $RegIP" . "\r\n" . "Host: $RegHost";
126
+							$RegMessage .= " registered on your site";
127
+							$RegMessage .= "<br>Profile link: " . "<a href='" . $url . "/viewuser.php?uid=" . $useruid . "'>" . $penname . "</a>";
128
+
129
+							$RegNoticeTo_array=explode(',', $RegNoticeTo);
130
+							foreach ($RegNoticeTo_array AS $RegNoticeTo_email) {
131
+								if(validEmail($RegNoticeTo_email)) {
132
+									sendemail($sitename, $RegNoticeTo_email, $siteemail, $siteemail, $RegSubject,  $RegMessage);
133
+								}
134
+							}
135
+
136
+						}
137
+					}
138
+					/* registration notice end */
139
+
111 140
 					dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET newestmember = '".$useruid."', members = members + 1");
112 141
 					if(defined("AUTHORPREFIX")) dbquery("UPDATE ".AUTHORPREFIX."fanfiction_stats SET newestmember = '".$useruid."', members = members + 1");
113 142
 					unset($_POST['submit']);
... ...
@@ -121,7 +150,7 @@ function random_string ($charset_string, $length)
121 150
 		else{
122 151
 			 if(($_POST['password']) && ($_POST['password2'])) {
123 152
 				if($_POST['password'] == $_POST['password2']) {
124
-					$encryppassword = md5($_POST['password']);
153
+					$encryppassword = password_hash($_POST['password'], PASSWORD_BCRYPT, ['cost' => 12]);
125 154
 					dbquery("UPDATE "._AUTHORTABLE." SET password='$encryppassword' WHERE uid = '$uid'");
126 155
 				}
127 156
 				else $output .=  write_error(_PASSWORDTWICE);
... ...
@@ -133,7 +162,7 @@ function random_string ($charset_string, $length)
133 162
 				}
134 163
 				else {
135 164
 					dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$_POST[uid]'");
136
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST[oldpenname], $uid, $penname))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB')");
165
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST['oldpenname'], $uid, $penname))."', '".USERUID."', INET6_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB', " . time() . ")");
137 166
 				}
138 167
 			}
139 168
 /* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
... ...
@@ -151,7 +180,7 @@ function random_string ($charset_string, $length)
151 180
 			}
152 181
 /* End dynamic fields */
153 182
 			dbquery("UPDATE "._AUTHORTABLE." SET realname='".descript(strip_tags(escapestring($_POST['realname'])), $allowed_tags)."', email='$email', bio='".descript(strip_tags(escapestring($_POST['bio']), $allowed_tags))."', image='".($imageupload && !empty($_POST['image']) ? escapestring($_POST['image']) : "")."' WHERE uid = '$uid'");
154
-			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT));
183
+			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT." "._LOGINAGAIN));
155 184
 		}
156 185
 	}
157 186
 	else {
... ...
@@ -168,7 +197,7 @@ function random_string ($charset_string, $length)
168 197
 			list($tos) = dbrow($query);
169 198
 			$output .= "<div class='tblborder' style='width: 90%; margin: 1em auto;'>$tos</div>";
170 199
 		}
171
-		$output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" style='margin: 0 auto;' action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
200
+		$output .= "<div id='settingsform'><form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='width: 260%; margin: 0 auto;' action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
172 201
 		<div><label for='newpenname'>"._PENNAME.":</label>";
173 202
 		if((isADMIN && uLEVEL == 1) || $action == "register")
174 203
 			$output .= "<INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".(isset($user) ? $user['penname'] : "")."\"><INPUT name=\"oldpenname\" type=\"hidden\" value=\"".(isset($user) ? $user['penname'] : "")."\"><font color=\"red\">*</font> ";
... ...
@@ -213,4 +242,4 @@ function random_string ($charset_string, $length)
213 242
 	 	}
214 243
 	 	$output .= "</div></form></div>".write_message("<font color=\"red\">*</font> "._REQUIREDFIELDS);
215 244
 	}
216
-?>
217 245
\ No newline at end of file
246
+?>