[UPDATE 20th Feb] sc_set_global and some php code not workinkig since this morning

Hi,

I had a login form with the following “onvalidate” event…


require_once(‘C:\Program Files\NetMake\v7\components\php\includes\lib
usoap.php’);

unset ($result);
$usr = {User};
$pwd = {Password};
$wsdl = “http://xxxxxxxxxxxxxxxxxx/Services/PublicApiService.svc?wsdl”;
$client = new nusoap_client($wsdl, ‘wsdl’);

// Check for an error
$err = $client->getError();
if ($err) {
// Display the error
echo ‘<h2>Constructor error</h2><pre>’ . $err . ‘</pre>’;
// At this point, you know the call that follows will fail
}

$client->soap_defencoding = ‘UTF-8’;
$client->decode_utf8 = false;

$result = $client -> call(‘Logon’, array(‘login’ => $usr, ‘password’ => $pwd));

if (isset ($result[‘LogonResult’]))
{
$sql = “SELECT
usuarios.id_cuenta,
cuentas.nombre
FROM
usuarios INNER JOIN cuentas ON usuarios.id_cuenta = cuentas.id_cuenta
WHERE
(usuarios.login = '”.$usr."’)";
sc_lookup(ds,$sql);
$cuenta = {ds[0][0]};
$nombre = {ds[0][1]};
sc_set_global([nombre]);
sc_redir(Menu.php, glo_cuenta = $cuenta);
}
else
{
sc_error_message (“The system could not log you in. Please check your user login and password and try again.”);
}


With the last update, I have notice two things:

  1. The sc_set_global is not working. I use this global variable (out) to show in the menu header the name of the logged user, but now, nothing is showed.

  2. The if clause now always goes thru the TRUE side, no matter the value of the boolean, which means I have no security at all.

Has anyone notice something similar?

Thanks for any help.
Rgds

Fernando.

Bert reported this global issue. See http://forum.scriptcase.net/showthread.php?3633-sc_set_global()-error-after-upgrading-to-7-00-0002

The soap message issue looks like something outside SC. The resultvalue itself is not checked, I mean you only get a result if you succeed? I don’t see a catch for a soap fault message.

Hi,

I just read the Bert`s post as soon as sent my message…

The workaround works perfectly, and someone is playing woth me today, because, as you suggested, I checked the webservice, and now, instead of returning a boolean, retuns a string with the word “true” or “false”, so I have modified the if clause, and works Ok too.

Thanks for you quik help.

Rgds
Fer.