function GetFreeLogin($email) { $objResponse = new xajaxResponse(); $login = ''; if (isset($_SESSION['login_generated']) && $_SESSION['login_generated']) { $login = $_SESSION['login_generated']; } else { $reg = new registration(); $reg->fillData(array('email' => $email)); if ($reg->login) { $_SESSION['login_generated'] = $login = $reg->login; } } if ($login) { $objResponse->script("\$('reg_login').set('value', '" . $login . "'); clear_error('reg_login')"); } return $objResponse; }