Verzeichnisstruktur phpBB-1.0.0
- Veröffentlicht
- 15.12.2000
So funktioniert es
|
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
sendpassword.php
001 <?php
002 /***************************************************************************
003 * sendpassword.php - description
004 * -------------------
005 * begin : Thurs Nov. 16 2000
006 * copyright : (C) 2000 by James Atkinson
007 * email : james@totalgeek.org
008 *
009 * $Id: sendpassword.php,v 1.3 2000/11/25 23:52:31 thefinn Exp $
010 *
011 * ***************************************************************************/
012
013 /***************************************************************************
014 *
015 * This program is free software; you can redistribute it and/or modify
016 * it under the terms of the GNU General Public License as published by
017 * the Free Software Foundation; either version 2 of the License, or
018 * (at your option) any later version.
019 *
020 ***************************************************************************/
021 include('extention.inc');
022 include('functions.'.$phpEx);
023 include('config.'.$phpEx);
024 require('auth.'.$phpEx);
025 $pagetype = "other";
026 $pagetitle = "Send Password";
027 include('page_header.'.$phpEx);
028
029 if($actkey) {
030 $sql = "SELECT user_id FROM users WHERE user_actkey = '$actkey'";
031 if(!$r = mysql_query($sql, $db))
032 die("Error while attempting to query the database");
033 if(mysql_num_rows($r) != 1) {
034 echo "The activation key you provided is not correct. Please check email message you recived and make sure you have copied the activation key exactly.";
035 include('page_tail.'.$phpEx);
036 exit();
037 }
038 else {
039 list($update_id) = mysql_fetch_array($r);
040 }
041 $sql = "UPDATE users SET user_password = user_newpasswd WHERE user_id = '$update_id'";
042 if(!$r = mysql_query($sql, $db))
043 die("Error while attempting to query the database");
044 ?>
045 <TABLE BORDER="0" WIDTH="<?php echo $TableWidth?>" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP">
046 <TR><TD BGCOLOR="<?php echo $table_bgcolor?>">
047 <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
048 <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
049 <TD COLSPAN="2" ALIGN="CENTER"><b>Password Sent</b></TD>
050 </TR>
051 <TR ALIGN="LEFT">
052 <TD BGCOLOR="<?php echo $color2?>">Your password has been successfully changed. You may now goto your <a href="bb_profile.<?php echo $phpEx?>?mode=edit">profile</a> and change your password to a more suitable one.
053 </TD></TR></TABLE></TABLE>
054 <?php
055 }
056 else if($submit) {
057 $checkinfo = get_userdata($user, $db);
058 if($checkinfo[user_email] != $email) {
059 echo "The email address you entered does not match the one stored in our database. Please go back and try again.";
060 include('page_tail.'.$phpEx);
061 exit();
062 }
063
064 $chars = array(
065 "a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
066 "k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T",
067 "u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8",
068 "9","0"
069 );
070 $max_elements = count($chars) - 1;
071 srand((double)microtime()*1000000);
072 $newpw = $chars[rand(0,$max_elements)];
073 $newpw .= $chars[rand(0,$max_elements)];
074 $newpw .= $chars[rand(0,$max_elements)];
075 $newpw .= $chars[rand(0,$max_elements)];
076 $newpw .= $chars[rand(0,$max_elements)];
077 $newpw .= $chars[rand(0,$max_elements)];
078 $newpw .= $chars[rand(0,$max_elements)];
079 $newpw .= $chars[rand(0,$max_elements)];
080 $newpw_enc = md5($newpw);
081
082 // Don't ask...
083 $key = md5(md5(md5($newpw_enc)));
084
085 $sql = "UPDATE users SET user_actkey = '$key', user_newpasswd = '$newpw_enc' WHERE user_id = '$checkinfo[user_id]'";
086 if(!$r = mysql_query($sql, $db)) {
087 echo "An error occured while tring to update the database. Please go back and try again.";
088 include('page_tail.'.$phpEx);
089 exit();
090 }
091 $subject = "$sitename Forums Password Change";
092 $message = "Dear $checkinfo[username],\r\n";
093 $message .= "You are reciving this email because you (or someone pretending to be you) has requested a password change on $sitename forums.\r\n";
094 $message .= "If you believe you have recived this message in error simply delete it and your old password will remain the same\r\n";
095 $message .= "\r\nYour new password as generated by the forums is: $newpw\r\n";
096 $message .= "In order for this change to take effect you must visit this page: http://$SERVER_NAME$PHP_SELF?actkey=$key\r\n";
097 $message .= "Once you have visited the page your password will be changed in our database, and you may login to the profile section and change it as desired.\r\n";
098 $message .= "Thank you for using $sitename Forums\r\n$email_sig";
099
100 mail($email, $subject, $message, "From: $email_from\r\nX-Mailer: phpBB/$phpbbversion");
101 ?>
102 <TABLE BORDER="0" WIDTH="<?php echo $TableWidth?>" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP">
103 <TR><TD BGCOLOR="<?php echo $table_bgcolor?>">
104 <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
105 <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
106 <TD COLSPAN="2" ALIGN="CENTER"><b>Password Sent</b></TD>
107 </TR>
108 <TR ALIGN="LEFT">
109 <TD BGCOLOR="<?php echo $color2?>">Your password has changed to a new, random, password. Please check your email on how to complete the password change procedure.
110 </TD>
111 </TR>
112 </TABLE></TABLE>
113 <?
114 }
115 else {
116 ?>
117 <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="POST">
118 <TABLE BORDER="0" WIDTH="<?php echo $TableWidth?>" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP"><TR><TD BGCOLOR="<?php echo $table_bgcolor?>">
119 <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
120 <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
121 <TD COLSPAN="2" ALIGN="CENTER"><b>Email Lost Password</b><BR>Please fill in your username (if it is not already filled in for you) and the email address you registered under and a new password will be generated and send to that email address.</TD>
122 </TR>
123 <TR ALIGN="LEFT">
124 <TD BGCOLOR="<?php echo $color1?>">Username:</TD>
125 <TD BGCOLOR="<?php echo $color2?>"><INPUT TYPE="TEXT" NAME="user" VALUE="<?php echo $userdata[username]?>" SIZE="35" MAXLENGHT="50"></TD>
126 </TR>
127 <TR ALIGN="LEFT">
128 <TD BGCOLOR="<?php echo $color1?>">Email Addresss:</TD>
129 <TD BGCOLOR="<?php echo $color2?>"><INPUT TYPE="TEXT" NAME="email" SIZE="35" MAXLENGTH="100"></TD>
130 </TR>
131 <TR BGCOLOR="<?php echo $color1?>" ALIGN="LEFT">
132 <TD COLSPAN="2" ALIGN="CENTER"><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Send Password"> <INPUT TYPE="RESET" VALUE="Clear"></TD>
133 </TR>
134
135 </TABLE></TABLE>
136
137
138 <?php
139 }
140 include('page_tail.'.$phpEx);
141 ?>
142