| 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 |