array( 'name' => 'forgot_form', 'action' => $_SERVER['PHP_SELF'], 'method' => 'post', ), 'params' => array ( 'db' => array( 'submit_name' => 'do_submit', ), 'checker_helper' => 'BxDolForgotCheckerHelper', ), 'inputs' => array( array( 'type' => 'email', 'name' => 'Email', 'caption' => _t('_My Email'), 'value' => isset($_POST['Email']) ? $_POST['Email'] : '', 'required' => true, 'checker' => array( 'func' => 'email', 'error' => _t( '_Incorrect Email' ) ), ), array( 'type' => 'captcha', 'name' => 'captcha', 'caption' => _t('_Enter Captcha'), 'required' => true, 'checker' => array( 'func' => 'captcha', 'error' => _t( '_Incorrect Captcha' ), ), ), array( 'type' => 'submit', 'name' => 'do_submit', 'value' => _t( "_Retrieve my information" ), 'colspan' => true, ), ) ); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ( $oForm->isSubmittedAndValid() ) { // Check if entered email is in the base $sEmail = process_db_input($_POST['Email'], BX_TAGS_STRIP); $memb_arr = db_arr( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$sEmail'" ); $recipient = $sEmail; $rEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $rEmailTemplate -> getTemplate( 't_Forgot', $memb_arr['ID'] ) ; $aPlus['Password'] = generateUserNewPwd($memb_arr['ID']); $aProfile = getProfileInfo($memb_arr['ID']); $mail_ret = sendMail( $recipient, $aTemplate['Subject'], $aTemplate['Body'], $memb_arr['ID'], $aPlus); // create system event require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'); $oZ = new BxDolAlerts('profile', 'password_restore', $memb_arr['ID']); $oZ->alert(); $_page['header'] = _t( "_Recognized" ); $_page['header_text'] = _t( "_RECOGNIZED", $site['title'] ); if ($mail_ret) $action_result = _t( "_MEMBER_RECOGNIZED_MAIL_SENT", $site['url'], $site['title'] ); else $action_result = _t( "_MEMBER_RECOGNIZED_MAIL_NOT_SENT", $site['title'] ); $sForm = ''; } else { $action_result = _t( "_FORGOT", $site['title'] ); $sForm = $oForm->getCode(); } $sPageCode = << $action_result $sForm BLAH; $_page_cont[$_ni]['page_main_code'] = $sPageCode; // --------------- [END] page components PageCode(); // --------------- page components functions function generateUserNewPwd($ID) { $sPwd = genRndPwd(); $sSalt = genRndSalt(); $sQuery = " UPDATE `Profiles` SET `Password` = '" . encryptUserPwd($sPwd, $sSalt) . "', `Salt` = '$sSalt' WHERE `ID`='$ID' "; db_res($sQuery); createUserDataFile($ID); require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'); $oZ = new BxDolAlerts('profile', 'edit', $ID); $oZ->alert(); return $sPwd; } ?>