Announcement

Collapse
No announcement yet.

Session variables not accessable (any more?)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Session variables not accessable (any more?)

    I start my application:

    http://127.0.0.1:97/scriptcase/app/D...p?hk=111000002

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

    Code:
    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.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    Hello,

    I will get in touch with our bugs team.

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      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)
      Last edited by aducom; 10-16-2013, 01:39 PM.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Use $_SESSION['hk'] = $_GET['hk'] ... Undefined index hk is correct, because $_SESSION['hk'] is not exist, when you start your app.
        Best regards: - Reinhard -

        I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

        Comment


        • #5
          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.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Originally posted by aducom View Post
            But I still don't get it why $_Session doesn't work.
            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:

            Code:
            <?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.
            Best regards: - Reinhard -

            I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

            Comment


            • #7
              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.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment

              Working...
              X