Global Variables

After the last update of Scriptcase the global variable doesn’t work.
In my login form on validate I’ve this code:

$usr = {user};
$pwd = {password};
$sql = “SELECT
user,
password,
IDdipendente
FROM
dipendenti
WHERE
(user = '”.$usr."’) AND
(password = ‘".$pwd."’)";
sc_lookup(ds, $sql);
if (isset({ds[0][0]}))
{
$usr_login = {ds[0][2]};
sc_set_global($usr_login);
sc_redir(menu)
}
else
{
echo “Nome utente o password errati”;

}

and in the application I use [usr_login]. And has always worked. But after last update It doesn’t work.
somebody can help me?

sc_set_global() is depraced (WebHelp: “This macro will be discontinued soon.”). Use [usr_login] = {ds[0][2]};

The sc_set_global macro still works on 0030.

Mirko, check the “Application->Global Variables” section of the applications that use [usr_login] and make sure that global variable is defined as a SESSION variable, and that [x] In is checked on the apps that use it. Your login app should probably declare the variable as [x] Out.

When the Application->Global Variables is not set up properly, the behavior is unpredictable: it might work fine, it might not.

If your variable doesn’t appear in Application->Global Variables, add the following code to the app’s onScriptInit event:

$user = [usr_login];

Save the application, and go back to Application->Global Variables. It will be there now.

sc_set_global() is depraced

Yes, the docs tell that for years now, but it’s still there and even the fresh generated security module is still using this. I advise to use the [] notation, but I don’t expect to see this macro leave soon.