Pass language parameter to scriptcase login window

Hello,

I created a small program with scriptcase with two languages. My first webpage is a Login page.

in onApplicationInit I have following code: (I am not sure if this is the correct way to set a language but it seems to work)
if([language] == ‘de’)
{
sc_set_language(‘de’);
$_SESSION[‘scriptcase’][‘str_lang’] = “de”;
$_SESSION[“scriptcase”][“str_conf_reg”] = “de_de”; //Regianla settings
}
else
{
sc_set_language(‘en_us’);
$_SESSION[‘scriptcase’][‘str_lang’] = “en_us”;
$_SESSION[“scriptcase”][“str_conf_reg”] = “en_us”; //Regianla settings
}

Now my question! I want to redirect to this page from a website. My input global variable is [language], so how can I pass this parameter from other webpage which is made with Typo3 or Wordpress or JS or HTML. The main webpage will be created by friend of my later.

BR
Stefan

Hi Stefan,

if the name of your login application is
my_login.php
you can call it using:
https://your_url/my_login.php?language=de

Simply use the ‘global variable’ language as GET-parameter in the URL.

This is a plain URL (or link), which you can call in any other application, email, …

Hope this helps.

Best
Gunter Eibl

You can use the following code available in the SC security module and adjust it to your needs. Works like a charm :slight_smile:You can find it in the “secapp_Login” application in the “OnApplicationInit” event.

sc_reset_apl_conf(“secapp_form_add_users”);
sc_reset_apl_conf(“secapp_retrieve_pswd”);

// jfd 06.08.2020: Gestion du multi-langue
$http_lang = substr($_SERVER[“HTTP_ACCEPT_LANGUAGE”], 0, 2);

switch ($http_lang)
{
case ‘fr’:
sc_set_language(‘fr’);
break;
case ‘de’:
sc_set_language(‘de’);
break;
case ‘it’:
sc_set_language(‘it’);
break;
case ‘en’:
sc_set_language(‘en_us’);
break;
default:
sc_set_language(‘fr’);
}
$bp_user_lang = $http_lang;

//echo "
bp_user_lang (1) = " . $bp_user_lang;

if(isset($_GET[‘lang’]) && !empty($_GET[‘lang’]))
{
$get_lang = $_GET[‘lang’];

switch ($get_lang)
{
	case 'fr':
	  sc_set_language('fr');
	  break;
	case 'de':
	  sc_set_language('de');
	  break;
	case 'it':
	  sc_set_language('it');
	  break;
	case 'en':
  		sc_set_language('en_us');
  		break;			
	default:
	  sc_set_language('fr');			
}
$bp_user_lang = $get_lang;

}

Thank you Gunter.

Jefch thank you also for the tip with the language. Strange but my security module doesnt create this code. I have the last version of scriptcase.

Hi I tried the code below and adjusted it a bit. But it doesn’t work. I just don’t understand why. It works if I pass parameter manually, but not automatically.
my index.php looks following way.

<?php
	$str_apl = 'app_Login?language=de';
	if(is_file("_lib/friendly_url/" . $str_apl . '_ini.txt'))
	{
		$str_apl = file_get_contents("_lib/friendly_url/" . $str_apl . '_ini.txt');
	}
	else
	{
		$str_apl = $str_apl . '/';
	}
    header("Location: " . $str_apl);

?>