Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,83 @@
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(isMEMBER) accessDenied( );
45
+	$output = "<div id=\"pagetitle\">"._LOSTPASSWORD."</div>";
46
+
47
+	  if(isset($_POST['submit'])) {
48
+		if(validEmail($_POST['email'])) {
49
+			$result = dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." AS email FROM "._AUTHORTABLE." WHERE email = '".strtolower(escapestring(descript($_POST['email'])))."'");
50
+			list($uid, $penname, $email) = dbrow($result);
51
+			if(dbnumrows($result) == 0) $output .= write_message(_BADEMAIL);
52
+			else {
53
+				include("includes/emailer.php");
54
+				mt_srand((double)microtime() * 1000000);
55
+				$charset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';		
56
+				$pass = random_string($charset, 10);
57
+				$encryppass = md5($pass);
58
+				$subject = _NEWPWDSUB;
59
+				$mailtext = sprintf(_NEWPWDMSG, $pass);
60
+
61
+		
62
+				$result = sendemail($penname, $email, $sitename, $siteemail, $subject, $mailtext, "html");
63
+				if($result) {
64
+					$output .= write_message(_PASSWORDSENT);
65
+					dbquery("UPDATE ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." SET password='$encryppass' WHERE uid = '".$uid."'");
66
+				}
67
+				else $output .=  write_message(_EMAILFAILED);
68
+				if($logging) 
69
+					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')");
70
+			}
71
+
72
+		}
73
+		else $output .= write_message(_BADEMAIL);
74
+	}
75
+	else {
76
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=lostpassword\">
77
+		<table align=\"center\" width=\"300\">
78
+		<tr><td>"._ENTEREMAIL."</td></tr>
79
+		<tr><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\"> <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>
80
+		</td></tr></table>";
81
+	}
82
+
83
+?>
0 84
\ No newline at end of file