Announcement

Collapse
No announcement yet.

Alternative Error Message To "The Following Global Variables are Missing"

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

  • Alternative Error Message To "The Following Global Variables are Missing"

    Under some cases, global variables will be missing after a customer has logged out (ex: he opens 2 windows), or under a variety of other circumstances, such as bookmarking a URL and going back to it later without any of the previous globals set.

    How can I create a custom page or text for when this happens? At the very least, I'd like a custom header.

    Thanks!

  • #2
    If global variables are missing you have simply an error in your application which needs to be solved. I always advise to allocate the globals on a central spot, i.e. the logon page. Then you will never run into issues like these.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Agreed, but what if someone has 2 windows open and logs out from a different page? Or bookmarks an internal page?
      Your solution is good, but won't cover those cases. As silly as it is, you can image novice users bookmarking a page and then going back to it, seeing the error, and panicking.

      Comment


      • #4
        You can consider to use a small piece of code in the onscriptinit to sc_redir to the main page if you main global is not allocated or has the wrong value.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          I have the same issue but this happens when an application is kept idle for sometime where the session has expired. Here are the steps to undrerstand what is happening

          1) Keep the running application idle until the session expires
          2) Now click on any menu and where the application uses the global variable
          3) See the below, I clicked one link after the session expired and I am getting the error saying the below global variables are not found. When I log off from my application and login back then this error goes away
          4) I tried the below script in the onApplicationInit event but that script has not executed at all since I did not get any echo message

          if ( !isset([society_id]) )
          {
          echo 'Session Expired. Please logoff and login back';
          }
          else
          {
          echo 'Else';
          }
          Your help here how to detect this scenario and show an appropriate message to the user will be highly helpful.




          Thank you

          Comment


          • #6
            anyone found a solution yet for this?

            Comment


            • #7
              Originally posted by aducom View Post
              You can consider to use a small piece of code in the onscriptinit to sc_redir to the main page if you main global is not allocated or has the wrong value.
              Aducom, Looks like this message fires before onscriptinit. I am setting global variable in the Login screen and in one of the screen I have used the below under onscriptinit event

              if (is_null([usr_id]) || empty([usr_id]))
              {
              echo 'Null or empty';
              sc_redir(login.php);
              }

              But this code is not getting executed I am still getting the message

              The following global variables are missing: usr_id;
              Last edited by nnara530; 05-30-2018, 01:43 AM.

              Comment


              • #8
                If a user logs out then a few globals are destroyed, one of it is usr_id. That's in your (generated) logon procedure. If anything happens elsewhere in your application you get this message. I think that if you change the destroy and just erase the data then you should not get this error any more. But in your case I would not use is_null, which is a value, but isset which checks if the variable exists.
                Albert Drent
                aducom software netherlands
                scriptcase partner, reseller, support and (turn-key) development
                www.scriptcase.eu / www.scriptcase.nl

                Comment


                • #9
                  I have even used isset but that also not working

                  Comment

                  Working...
                  X