$lang['admin_reg_user_email_text'] = str_replace("[name]", $ar_username, $lang['admin_reg_user_email_text']); $lang['admin_reg_user_email_text'] = str_replace("[password]", $ar_pw, $lang['admin_reg_user_email_text']); $lang['admin_reg_user_email_text'] = str_replace("[login_link]", $settings['forum_address'] . "index.php?mode=login&username="******"&userpw=" . $ar_pw, $lang['admin_reg_user_email_text']); $lang['admin_reg_user_email_text'] = stripslashes($lang['admin_reg_user_email_text']); $header = "From: " . $settings['forum_name'] . " <" . $settings['forum_email'] . ">\n"; $header .= "X-Mailer: Php/" . phpversion() . "\n"; $header .= "X-Sender-ip: " . $_SERVER["REMOTE_ADDR"] . "\n"; $header .= "Content-Type: text/plain; charset=" . CHARSET . "\n"; $header .= "Content-transfer-encoding: 8bit\n"; $new_user_mailto = my_mb_encode_mimeheader($ar_username, CHARSET, "Q") . " <" . $ar_email . ">"; if ($settings['mail_parameter'] != '') { if (!@mail($new_user_mailto, my_mb_encode_mimeheader($lang['admin_reg_user_email_subj'], CHARSET, "Q"), $lang['admin_reg_user_email_text'], $header, $settings['mail_parameter'])) { $send_error = '&send_error=true'; } } else { if (!@mail($new_user_mailto, my_mb_encode_mimeheader($lang['admin_reg_user_email_subj'], CHARSET, "Q"), $lang['admin_reg_user_email_text'], $header)) { $send_error = '&send_error=true'; } } } header("location: index.php?mode=admin&action=user&new_user=" . urlencode($ar_username) . $send_error); exit; } else { $smarty->assign('errors', $errors); $smarty->assign('ar_username', $ar_username); $smarty->assign('ar_email', $ar_email); $action = 'register'; } } if (isset($_POST['spam_protection_submit'])) { $action = 'spam_protection_submit';
$new_user_notif_txt = $lang['new_user_notif_txt_locked']; } else { $new_user_notif_txt = $lang['new_user_notif_txt']; } $new_user_notif_txt = str_replace("[name]", $data['user_name'], $new_user_notif_txt); $new_user_notif_txt = str_replace("[email]", $data['user_email'], $new_user_notif_txt); $new_user_notif_txt = str_replace("[user_link]", $settings['forum_address'] . "index.php?mode=user&show_user="******"SELECT user_name, user_email FROM " . $db_settings['userdata_table'] . " WHERE user_type>0 AND new_user_notification=1", $connid); if (!$admin_result) { raise_error('database_error', mysql_error()); } while ($admin_array = mysql_fetch_array($admin_result)) { $ind_reg_emailbody = str_replace("[recipient]", $admin_array['user_name'], $new_user_notif_txt); $admin_mailto = my_mb_encode_mimeheader($admin_array['user_name'], CHARSET, "Q") . " <" . $admin_array['user_email'] . ">"; my_mail($admin_mailto, $lang['new_user_notif_sj'], $ind_reg_emailbody); } } if ($settings['register_mode'] == 1) { header("Location: index.php?mode=login&login_message=account_activated_but_locked"); } else { header("Location: index.php?mode=login&login_message=account_activated"); } exit; } else { $error = true; } } if (isset($error)) { $smarty->assign('lang_section', 'register');
/** * sends an email * * @param string $to * @param string $subject * @param string $message * @param string $headers * @return string */ function my_mail($to, $subject, $message, $from = '') { global $settings; if ($from == '') { $headers = "From: " . my_mb_encode_mimeheader($settings['forum_name'], CHARSET, "Q") . " <" . $settings['forum_email'] . ">" . MAIL_HEADER_SEPARATOR; } else { $headers = "From: " . $from . MAIL_HEADER_SEPARATOR; } $headers .= "X-Sender-IP: " . $_SERVER["REMOTE_ADDR"] . MAIL_HEADER_SEPARATOR; $headers .= "X-Mailer: " . $settings['forum_address'] . MAIL_HEADER_SEPARATOR; $headers .= "Content-Type: text/plain; charset=" . CHARSET . MAIL_HEADER_SEPARATOR; $headers .= "Content-transfer-encoding: 8bit" . MAIL_HEADER_SEPARATOR; $subject = my_mb_encode_mimeheader($subject, CHARSET, "Q"); // for debugging: /* echo '<pre>'; echo $headers; echo "\n\n"; echo $to . "\n" . $subject . "\n\n" . $message; exit; */ if ($settings['mail_parameter'] != '') { if (@mail($to, $subject, $message, $headers, $settings['mail_parameter'])) { return true; } else { return false; } } else { if (@mail($to, $subject, $message, $headers)) { return true; } else { return false; } } }
$lang['new_pw_email_txt'] = str_replace("[password]", $new_pw, $lang['new_pw_email_txt']); $lang['new_pw_email_txt'] = str_replace("[login_link]", $settings['forum_address'] . basename($_SERVER['PHP_SELF']) . "?mode=login&username="******"&userpw=" . $new_pw, $lang['new_pw_email_txt']); $lang['new_pw_email_txt'] = stripslashes($lang['new_pw_email_txt']); $header = "From: " . my_mb_encode_mimeheader($settings['forum_name'], CHARSET, "Q") . " <" . $settings['forum_email'] . ">" . MAIL_HEADER_SEPARATOR; $header .= "Content-Type: text/plain; charset=" . CHARSET . MAIL_HEADER_SEPARATOR; $header .= "Content-transfer-encoding: 8bit" . MAIL_HEADER_SEPARATOR; $new_pw_mailto = my_mb_encode_mimeheader($field['user_name'], CHARSET, "Q") . " <" . $field['user_email'] . ">"; if ($settings['mail_parameter'] != '') { if (@mail($new_pw_mailto, my_mb_encode_mimeheader($lang['new_pw_email_sj'], CHARSET, "Q"), $lang['new_pw_email_txt'], $header, $settings['mail_parameter'])) { header("location: index.php?mode=login&login_message=pw_sent"); die("<a href=\"index.php?mode=login&login_message=pw_sent\">further...</a>"); } else { die($lang['mail_error']); } } else { if (@mail($new_pw_mailto, my_mb_encode_mimeheader($lang['new_pw_email_sj'], CHARSET, "Q"), $lang['new_pw_email_txt'], $header)) { header("location: index.php?mode=login&login_message=pw_sent"); die("<a href=\"index.php?mode=login&login_message=pw_sent\">further...</a>"); } else { die($lang['mail_error']); } } } else { header("location: index.php?mode=login&login_message=code_invalid"); die("<a href=\"index.php?mode=login&login_message=code_invalid\">further...</a>"); } } else { header("location: index.php?mode=login&login_message=code_invalid"); exit; } break;
$errors[] = 'error_email_invalid'; } if (!is_pw_correct($pw_new_email, $data['user_pw'])) { $errors[] = 'pw_wrong'; } } if (empty($errors)) { $smarty->config_load($settings['language_file'], 'emails'); $lang = $smarty->get_config_vars(); $activate_code = random_string(32); $activate_code_hash = generate_pw_hash($activate_code); // send mail with activation key: $lang['edit_address_email_txt'] = str_replace("[name]", $data['user_name'], $lang['edit_address_email_txt']); $lang['edit_address_email_txt'] = str_replace("[activate_link]", $settings['forum_address'] . "index.php?mode=register&id=" . $data['user_id'] . "&key=" . $activate_code, $lang['edit_address_email_txt']); $lang['edit_address_email_txt'] = stripslashes($lang['edit_address_email_txt']); $new_user_mailto = my_mb_encode_mimeheader($data['user_name'], CHARSET, "Q") . " <" . $new_email . ">"; if (!my_mail($new_user_mailto, $lang['edit_address_email_sj'], $lang['edit_address_email_txt'])) { $errors[] = 'error_mailserver'; } if (empty($errors)) { @mysql_query("UPDATE " . $db_settings['userdata_table'] . " SET user_email='" . mysql_real_escape_string($new_email) . "', last_login=last_login, registered=registered, activate_code = '" . mysql_real_escape_string($activate_code_hash) . "' WHERE user_id=" . intval($_SESSION[$settings['session_prefix'] . 'user_id']), $connid) or raise_error('database_error', mysql_error()); log_out($_SESSION[$settings['session_prefix'] . 'user_id']); header("Location: index.php"); exit; } } if (isset($errors)) { $smarty->assign('new_user_email', htmlspecialchars(stripslashes($new_email))); $smarty->assign('errors', $errors); $breadcrumbs[0]['link'] = 'index.php?mode=user'; $breadcrumbs[0]['linkname'] = 'subnav_userarea';