[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/includes/ -> usercp_activate.php (source)

   1  <?php
   2  /***************************************************************************
   3   *                            usercp_activate.php
   4   *                            -------------------
   5   *   begin                : Saturday, Feb 13, 2001
   6   *   copyright            : (C) 2001 The phpBB Group
   7   *   email                : support@phpbb.com
   8   *
   9   *   Id: usercp_activate.php,v 1.6.2.8 2005/07/19 20:01:16 acydburn Exp
  10   *
  11   *
  12   ***************************************************************************/
  13  
  14  /***************************************************************************
  15   *
  16   *   This program is free software; you can redistribute it and/or modify
  17   *   it under the terms of the GNU General Public License as published by
  18   *   the Free Software Foundation; either version 2 of the License, or
  19   *   (at your option) any later version.
  20   *
  21   *
  22   ***************************************************************************/
  23  
  24  if ( !defined('IN_PHPBB') )
  25  {
  26          die('Hacking attempt');
  27          exit;
  28  }
  29  
  30  $sql = "SELECT user_active, user_id, username, user_email, user_newpasswd, user_lang, user_actkey
  31          FROM " . USERS_TABLE . "
  32          WHERE user_id = " . intval($HTTP_GET_VARS[POST_USERS_URL]);
  33  if ( !($result = $db->sql_query($sql)) )
  34  {
  35          message_die(GENERAL_ERROR, 'Could not obtain user information', '', __LINE__, __FILE__, $sql);
  36  }
  37  
  38  if ( $row = $db->sql_fetchrow($result) )
  39  {
  40          if ( $row['user_active'] && empty(trim($row['user_actkey'])) )
  41          {
  42                  $template->assign_vars(array(
  43                          'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
  44                  );
  45  
  46                  message_die(GENERAL_MESSAGE, $lang['Already_activated']);
  47          }
  48          else if ((trim($row['user_actkey']) == trim($HTTP_GET_VARS['act_key'])) && (!empty(trim($row['user_actkey']))))
  49          {
  50          if (intval($board_config['require_activation']) == USER_ACTIVATION_ADMIN && $userdata['user_level'] != ADMIN)
  51          {
  52              message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
  53          }
  54  
  55                  $sql_update_pass = ( !empty($row['user_newpasswd']) ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : '';
  56  
  57                  $sql = "UPDATE " . USERS_TABLE . "
  58                          SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
  59                          WHERE user_id = " . $row['user_id'];
  60                  if ( !($result = $db->sql_query($sql)) )
  61                  {
  62                          message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
  63                  }
  64  
  65                  if ( intval($board_config['require_activation']) == USER_ACTIVATION_ADMIN && empty($sql_update_pass) )
  66                  {
  67                          include ("includes/emailer.php");
  68                          $emailer = new emailer($board_config['smtp_delivery']);
  69  
  70                          $emailer->from($board_config['board_email']);
  71                          $emailer->replyto($board_config['board_email']);
  72  
  73                          $emailer->use_template('admin_welcome_activated', $row['user_lang']);
  74                          $emailer->email_address($row['user_email']);
  75                          $emailer->set_subject($lang['Account_activated_subject']);
  76  
  77                          $emailer->assign_vars(array(
  78                                  'SITENAME' => $board_config['sitename'],
  79                                  'USERNAME' => $row['username'],
  80                                  'PASSWORD' => $password_confirm,
  81                                  'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '')
  82                          );
  83                          $emailer->send();
  84                          $emailer->reset();
  85  
  86                          $template->assign_vars(array(
  87                                  'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
  88                          );
  89  
  90                          message_die(GENERAL_MESSAGE, $lang['Account_active_admin']);
  91                  }
  92                  else
  93                  {
  94                          $template->assign_vars(array(
  95                                  'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
  96                          );
  97  
  98                          $message = ( $sql_update_pass == '' ) ? $lang['Account_active'] : $lang['Password_activated'];
  99                          message_die(GENERAL_MESSAGE, $message);
 100                  }
 101          }
 102          else
 103          {
 104                  message_die(GENERAL_MESSAGE, $lang['Wrong_activation']);
 105          }
 106  }
 107  else
 108  {
 109          message_die(GENERAL_MESSAGE, $lang['No_such_user']);
 110  }
 111  
 112  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7