/** * function to process form data * * @param $aFormValues (array) login form data $aFormValues['username'] $aFormValues['password'] $aFormValues['locate'] * @return $objResponse */ function processForm($aFormValues) { global $locate; $objResponse = new xajaxResponse(); list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']); //get locate parameter $locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'login'); //init localization class if (trim($aFormValues['username']) == "") { $objResponse->addAlert($locate->Translate("Username cannot be blank")); $objResponse->addScript('init();'); return $objResponse; } if (trim($aFormValues['password']) == "") { $objResponse->addAlert($locate->Translate("Password cannot be blank")); $objResponse->addScript('init();'); return $objResponse; } if (array_key_exists("username", $aFormValues)) { if (ereg("[0-9a-zA-Z\\@\\.]+", $aFormValues['username']) && ereg("[0-9a-zA-Z]+", $aFormValues['password'])) { // passed return processAccountData($aFormValues); } else { // error $objResponse->addAlert($locate->Translate("Invalid string")); $objResponse->addScript('init();'); return $objResponse; } } else { $objResponse = new xajaxResponse(); return $objResponse; } }
function processForm($aFormValues) { if (array_key_exists("username", $aFormValues)) { return processAccountData($aFormValues); } else { if (array_key_exists("firstName", $aFormValues)) { return processPersonalData($aFormValues); } } }
/** * function to process form data * * @param $aFormValues (array) login form data $aFormValues['username'] $aFormValues['password'] $aFormValues['locate'] * @return $objResponse */ function processForm($aFormValues) { global $config; list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']); //get locate parameter $locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'login'); $objResponse = new xajaxResponse(); global $locate; if ($config['system']['validcode'] == 'yes') { if (trim($aFormValues['code']) != $_SESSION["Checknum"]) { $objResponse->addAlert('Invalid code'); $objResponse->addScript('init();'); return $objResponse; } } if (trim($aFormValues['username']) == "") { $objResponse->addAlert($locate->Translate("username_cannot_be_blank")); $objResponse->addScript('init();'); return $objResponse; } if (trim($aFormValues['password']) == "") { $objResponse->addAlert($locate->Translate("password_cannot_be_blank")); $objResponse->addScript('init();'); return $objResponse; } if (array_key_exists("username", $aFormValues)) { if (ereg("[0-9a-zA-Z]+", $aFormValues['username']) && ereg("[0-9a-zA-Z]+", $aFormValues['password'])) { // passed return processAccountData($aFormValues); } else { // error $objResponse->addAlert($locate->Translate("invalid_string")); $objResponse->addScript('init();'); return $objResponse; } } else { $objResponse = new xajaxResponse(); return $objResponse; } }