Forgotten password email problem (General)
Hello
yes.... but maybe I am misunderstanding your code modification instructions.
No, I think, my posted code is misleading. the codebox with the old code shows as last few lines:
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']); }
The last bracket is the end of the first else
(here: line 1) wich is the counterpart of if($settings['mail_parameter']!='')
(should be line 254 in the old code; please compare to the old posting).
The shown new code contains a closing bracket too:
if(my_mail($new_pw_mailto, $lang['new_pw_email_sj'], $lang['new_pw_email_txt'])) { 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']); }
But: this bracket is the counterpart of the opening if
from line 229. This said it may be, that you have a supernumerous closing bracket.
To make clear, what happens I will show the whole block for the case
option "activate" (at line 222). Please compare it with your code, comments with leading and trailing "##########" are mine.
case "activate": ########## line 222 ########## if (isset($_GET['activate']) && trim($_GET['activate']) != "" && isset($_GET['code']) && trim($_GET['code']) != "") { $pwf_result = mysql_query("SELECT user_id, user_name, user_email, pwf_code FROM ".$db_settings['userdata_table']." WHERE user_id = '".intval($_GET["activate"])."'", $connid); if (!$pwf_result) raise_error('database_error',mysql_error()); $field = mysql_fetch_array($pwf_result); mysql_free_result($pwf_result); if(trim($field['pwf_code'])!='' && $field['user_id'] == $_GET['activate'] && is_pw_correct($_GET['code'],$field['pwf_code'])) { // generate new password: if($settings['min_pw_length']<8) $pwl = 8; else $pwl = $settings['min_pw_length']; $new_pw = random_string($pwl); $pw_hash = generate_pw_hash($new_pw); $update_result = mysql_query("UPDATE ".$db_settings['userdata_table']." SET last_login=last_login, registered=registered, user_pw='".mysql_real_escape_string($pw_hash)."', pwf_code='' WHERE user_id='".$field["user_id"]."' LIMIT 1", $connid); // send new password: $smarty->config_load($settings['language_file'],'emails'); $lang = $smarty->get_config_vars(); ########## next line: 242 (without this comment) ########## $lang['new_pw_email_txt'] = str_replace("[name]", $field['user_name'], $lang['new_pw_email_txt']); $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=".urlencode($field['user_name'])."&userpw=".$new_pw, $lang['new_pw_email_txt']); $lang['new_pw_email_txt'] = $lang['new_pw_email_txt']; $new_pw_mailto = my_mb_encode_mimeheader($field['user_name'], CHARSET, "Q")." <".$field['user_email'].">"; if(my_mail($new_pw_mailto, $lang['new_pw_email_sj'], $lang['new_pw_email_txt'])) { 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; } $smarty->assign('action',$action);
Tschö, Auge
PS (to Alex): I could not set a single link inside the posting because the spamtest routine rejects the posting with the link.