| ... | ... |
@@ -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 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,80 @@ |
| 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 |
+?> |
|
| 0 | 81 |
\ No newline at end of file |