add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_DEFAULT)); } if (isset($_POST['login'])) { zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); } $error_check = false; if (isset($_POST['submit'])) { if ( !$_POST['admin_email'] ) { $error_check = true; $email_message = ERROR_WRONG_EMAIL_NULL; } $admin_email = zen_db_prepare_input($_POST['admin_email']); $sql = "select admin_id, admin_name, admin_email, admin_pass from " . TABLE_ADMIN . " where admin_email = '" . zen_db_input($admin_email) . "'"; $result = $db->Execute($sql); if (!($admin_email == $result->fields['admin_email'])) { $error_check = true; $email_message = ERROR_WRONG_EMAIL; } if ($error_check == false) { $new_password = zen_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $admin_pass = zen_encrypt_password($new_password); $sql = "update " . TABLE_ADMIN . " set admin_pass = '" . zen_db_input($admin_pass) . "' where admin_email = '" . $result->fields['admin_email'] . "'"; $db->Execute($sql); $html_msg['EMAIL_CUSTOMERS_NAME'] = $result->fields['admin_name']; $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(TEXT_EMAIL_MESSAGE, $new_password); zen_mail($result->fields['admin_name'], $result->fields['admin_email'], TEXT_EMAIL_SUBJECT, sprintf(TEXT_EMAIL_MESSAGE, $new_password), STORE_NAME, EMAIL_FROM, $html_msg, 'password_forgotten_admin'); $email_message = SUCCESS_PASSWORD_SENT; } } ?> >