function api_signinUser($i_username = '', $i_password = '', $i_isguest = false)
{
    return signinUser($i_username, $i_password, $i_isguest);
}
<?php

$f_username = readPostVar('username', readGetVar('username'));
$f_password = readPostVar('password', readGetVar('password'));
$f_bguest = isset($_POST['bguest']) || isset($_GET['bguest']);
$G_SESSION['test_code'] = readPostVar('test_code');
if (signinUser($f_username, $f_password, $f_bguest)) {
    $i_gotourl = isset($_POST['gotourl']) && strpos($_POST['gotourl'], '/register.php') === false && strpos($_POST['gotourl'], '/lostpassword.php') === false && strpos($_POST['gotourl'], '/account.php') === false && strpos($_POST['gotourl'], '/signin.php') === false ? $_POST['gotourl'] : 'index.php';
    gotoLocation($i_gotourl);
} else {
    if (empty($f_username) && empty($f_password) && getConfigItem(CONFIG_can_register)) {
        gotoLocation('register.php');
    } else {
        $g_vars['page']['title'] = $lngstr['page_title_signin'];
        $g_vars['page']['errors'] = $lngstr['err_signin_incorrect'];
        include_once $DOCUMENT_PAGES . 'signin-1.inc.php';
    }
}
     unset($f_username);
     include_once $DOCUMENT_PAGES . "register-1.inc.php";
 } else {
     if ($i_CONFIG_reg_username == CONFIG_CONST_donotshow_autogenerate || $i_CONFIG_reg_username == CONFIG_CONST_show_autogenerate && getRecordCount($srv_settings['table_prefix'] . 'users', "username="******"UPDATE " . $srv_settings['table_prefix'] . "users SET username="******" WHERE id=" . $i_id);
         $_POST['username'] = $f_username;
     }
     sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_REGISTRATION_INDEX, 'emailto' => array($f_email), 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword));
     $i_admin_emails = getRecordItem($srv_settings['table_prefix'] . 'etemplates', 'etemplate_from', 'etemplateid=' . SYSTEM_ETEMPLATES_ACTIVATE_INDEX);
     $i_admin_emails = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, $i_admin_emails);
     sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_REGISTRATION_INDEX_FOR_ADMIN, 'emailto' => $i_admin_emails, 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword));
     switch (getConfigItem(CONFIG_upon_registration)) {
         case CONFIG_CONST_upon_registration_signinautomatically:
             activateUserByID($i_id, true);
             signinUser($f_username, $f_password, false);
             if ($f_testid > 0) {
                 gotoLocation('test.php?testid=' . $f_testid);
             } else {
                 gotoLocation('index.php');
             }
             break;
         case CONFIG_CONST_upon_registration_sendactivationemailtouser:
             sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_ACTIVATE_INDEX, 'emailto' => array($f_email), 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword));
             $g_vars['page']['notifications'] = $lngstr['page-register']['check_activation_email'];
             include_once $DOCUMENT_PAGES . "signin-1.inc.php";
             break;
         case CONFIG_CONST_upon_registration_sendactivationemailtoadmin:
             $i_admin_emails = getRecordItem($srv_settings['table_prefix'] . 'etemplates', 'etemplate_from', 'etemplateid=' . SYSTEM_ETEMPLATES_ACTIVATE_INDEX);
             $i_admin_emails = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, $i_admin_emails);
             sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_ACTIVATE_INDEX, 'emailto' => $i_admin_emails, 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword));