I am developing a project in which a form pulls data from a table named ResourceRequests. It includes fields for the user’s telephone numbers, which are already stored in the sec_users table. When the form is loaded, I would like the initial value of the contact information fields in this form to be set from the values in the sec_users table.
I added some lines of code in the Events > onValidate section of the sec_Login application to create global variables from the desired fields in the sec_users table. (These lines are marked below with the comment “# ADDED LINE”.) However, after adding this code, when I ran the login application and entered my login credentials, the application generated the error message “Sorry, but user is not active!” I then deleted the added lines, and I was able to login successfully. I find this a complete mystery.
How can I set these variables?
$slogin = sc_sql_injection({login});
$spswd = sc_sql_injection(({pswd}));
$sql = "SELECT
priv_admin,
active,
name,
email,
uOfficePhone, # ADDED LINE
uOfficeExt, # ADDED LINE
uOfficeMobilePhone # ADDED LINE
FROM sec_users
WHERE login = $slogin
AND pswd = ".$spswd."";
sc_lookup(rs, $sql);
if(count({rs}) == 0)
{
sc_log_add('login Fail', {lang_login_fail} . {login});
sc_error_message({lang_error_login});
sc_error_exit();
}
else if({rs[0][1]} == 'Y')
{
$usr_login = {login};
$usr_priv_admin = ({rs[0][0]} == 'Y') ? TRUE : FALSE;
$usr_name = {rs[0][2]};
$usr_email = {rs[0][3]};
$usr_off_phone = {rs[0][4]}; # ADDED LINE
$usr_off_ext = {rs[0][5]}; # ADDED LINE
$$user_mobile_phone = {rs[0][6]}; # ADDED LINE
sc_set_global($usr_login);
sc_set_global($usr_priv_admin);
sc_set_global($usr_name);
sc_set_global($usr_email);
sc_set_global($usr_off_phone); # ADDED LINE
sc_set_global($usr_off_ext); # ADDED LINE
sc_set_global($usr_mobile_phone); # ADDED LINE
}
else
{
sc_error_message({lang_error_not_active});
sc_error_exit();
}