How to redirect to login form instead of showing "Unauthorized user"

Hi,

I have an external (non-scriptcase) application that has a menu containing items that start SC applications. Security is enabled on all applications (except login). When I’m not logged on, and I start a SC form using the external menu, I do not want to see the “Unauthorized user” message. Instead I want to be redirected to the SC login application.

How can I do this?

thanks.

Re: How to redirect to login form instead of showing “Unauthorized user”

In each app, place some code that will redirect based on a condition in onInit:

if(!isset($_SESSION[‘global_mylogin_var’])) {
sc_redir(login.php);
}

Re: How to redirect to login form instead of showing “Unauthorized user”

I probably should substitute global_mylogin_var for something else?
And to go a step further, can I use this check in my custom app as well? Is the var known outside the SC applications?

Thanks.

Re: How to redirect to login form instead of showing “Unauthorized user”

Yes, you define your own variable, say LOGIN_NAME or something like that in the login app.

To you use it your other non-sc app, you can do the same, but you have to use PHP code to redir instead of a sc_macro, try:

header(‘Location:http://www.mycustomapp.com’);

Regards,
Scott.