Session variables not accessable (any more?)

I start my application:

http://127.0.0.1:97/scriptcase/app/DOHMWWW/general_login/general_login.php?hk=111000002

I retrieve the data of hk by using the session variable in onapplication init:


echo 'nu komt het ...'.$_SESSION['hk']; 

Now I get an error:

‘undefined index hk’

This used to work well. But now it isn’t any more? I need a quick fix.

Hello,

I will get in touch with our bugs team.

regards,
Bernhard Bernsmann

I did a echo $_SESSION. If you startup the application in your dev env. there’s a lot sc is adding to the url. But the echo just return ‘Array’. It realy is a very easy to reproduce issue. Just create an application of any kind and print the value.

THis is the generated code:
/* Menu items */
630| $_SESSION[‘scriptcase’][‘main’][‘contr_erro’] = ‘on’;
631| echo $_SESSION;
632| $_SESSION[‘scriptcase’][‘main’][‘contr_erro’] = ‘off’;
633| if ($this->Db)

Use $_SESSION[‘hk’] = $_GET[‘hk’] … Undefined index hk is correct, because $_SESSION[‘hk’] is not exist, when you start your app.

Thanks Reinhard, $_GET does do the job. But I still don’t get it why $_Session doesn’t work. You can put the line in the onload (where the session should be there) and still no result… But this works for me. Thanks again.

I don’t see why this should work at all … The first instructions in my generated apps (‘code_Autostart_session.php’ ist generated by SC) looks like:


<?php
   include_once('code_Autostart_session.php');
   @session_start() ;
   ...

Session_start() initialize the session handling, but before (your $_SESSION[‘hk’]) that is still no access possible … Right? And $_GET (or $_POST) is intended for transfer parameters in PHP.

Funny part is that it did worked … I can get it regarding the onscriptinit etc. But not on onload when the session is already started. But somehow the passed url parameters are not assigned to the session (any more). Couldn’t find code in the generated software. And I cannot see how it once worked.

But never mind. I’m glad I have the solution.