Verzeichnisstruktur phpBB-2.0.0


Veröffentlicht
03.04.2002

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

usercp_sendpasswd.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 4.23 KiB


 001  <?php
 002  /***************************************************************************
 003   *                           usercp_sendpasswd.php
 004   *                            -------------------
 005   *   begin                : Saturday, Feb 13, 2001
 006   *   copyright            : (C) 2001 The phpBB Group
 007   *   email                : support@phpbb.com
 008   *
 009   *   $Id$
 010   *
 011   *
 012   ***************************************************************************/
 013   
 014  /***************************************************************************
 015   *
 016   *   This program is free software; you can redistribute it and/or modify
 017   *   it under the terms of the GNU General Public License as published by
 018   *   the Free Software Foundation; either version 2 of the License, or
 019   *   (at your option) any later version.
 020   *
 021   *
 022   ***************************************************************************/
 023   
 024  if ( !defined('IN_PHPBB') )
 025  {
 026      die('Hacking attempt');
 027      exit;
 028  }
 029   
 030  if ( isset($HTTP_POST_VARS['submit']) )
 031  {
 032      $username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
 033      $email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : '';
 034   
 035      $sql = "SELECT user_id, username, user_email, user_active, user_lang 
 036          FROM " . USERS_TABLE . " 
 037          WHERE user_email = '" . str_replace("\'", "''", $email) . "' 
 038              AND username = '" . str_replace("\'", "''", $username) . "'";
 039      if ( $result = $db->sql_query($sql) )
 040      {
 041          if ( $row = $db->sql_fetchrow($result) )
 042          {
 043              if ( !$row['user_active'] )
 044              {
 045                  message_die(GENERAL_MESSAGE, $lang['No_send_account_inactive']);
 046              }
 047   
 048              $username = $row['username'];
 049              $user_id = $row['user_id'];
 050   
 051              $user_actkey = gen_rand_string(true);
 052              $key_len = 54 - strlen($server_url);
 053              $key_len = ($key_len > 6) ? $key_len : 6;
 054              $user_actkey = substr($user_actkey, 0, $key_len);
 055              $user_password = gen_rand_string(false);
 056              
 057              $sql = "UPDATE " . USERS_TABLE . " 
 058                  SET user_newpasswd = '" . md5($user_password) . "', user_actkey = '$user_actkey'  
 059                  WHERE user_id = " . $row['user_id'];
 060              if ( !$db->sql_query($sql) )
 061              {
 062                  message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql);
 063              }
 064   
 065              include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 066              $emailer = new emailer($board_config['smtp_delivery']);
 067   
 068              $emailer->from($board_config['board_email']);
 069              $emailer->replyto($board_config['board_email']);
 070   
 071              $emailer->use_template('user_activate_passwd', $row['user_lang']);
 072              $emailer->email_address($row['user_email']);
 073              $emailer->set_subject($lang['New_password_activation']);
 074   
 075              $emailer->assign_vars(array(
 076                  'SITENAME' => $board_config['sitename'], 
 077                  'USERNAME' => $username,
 078                  'PASSWORD' => $user_password,
 079                  'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 
 080   
 081                  'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
 082              );
 083              $emailer->send();
 084              $emailer->reset();
 085   
 086              $template->assign_vars(array(
 087                  'META' => '<meta http-equiv="refresh" content="15;url=' . append_sid("index.$phpEx") . '">')
 088              );
 089   
 090              $message = $lang['Password_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
 091   
 092              message_die(GENERAL_MESSAGE, $message);
 093          }
 094          else
 095          {
 096              message_die(GENERAL_MESSAGE, $lang['No_email_match']);
 097          }
 098      }
 099      else
 100      {
 101          message_die(GENERAL_ERROR, 'Could not obtain user information for sendpassword', '', __LINE__, __FILE__, $sql);
 102      }
 103  }
 104  else
 105  {
 106      $username = '';
 107      $email = '';
 108  }
 109   
 110  //
 111  // Output basic page
 112  //
 113  include($phpbb_root_path . 'includes/page_header.'.$phpEx);
 114   
 115  $template->set_filenames(array(
 116      'body' => 'profile_send_pass.tpl')
 117  );
 118  make_jumpbox('viewforum.'.$phpEx);
 119   
 120  $template->assign_vars(array(
 121      'USERNAME' => $username,
 122      'EMAIL' => $email,
 123   
 124      'L_SEND_PASSWORD' => $lang['Send_password'], 
 125      'L_ITEMS_REQUIRED' => $lang['Items_required'],
 126      'L_EMAIL_ADDRESS' => $lang['Email_address'],
 127      'L_SUBMIT' => $lang['Submit'],
 128      'L_RESET' => $lang['Reset'],
 129      
 130      'S_HIDDEN_FIELDS' => '', 
 131      'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=sendpassword"))
 132  );
 133   
 134  $template->pparse('body');
 135   
 136  include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
 137   
 138  ?>