Announcement

Collapse
No announcement yet.

blank application with redirect not working

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

  • blank application with redirect not working

    Can somebody find out why are the codes below not working inside a blank application. I'm using version 6.
    I confirmed that the query works, the redirect app works as well and expects the bannerID parameter.

    When I run the application, it's just blank--no error message. That means the redirect never takes place.

    Thanks for your help.


    /*
    * Determine if user is authenticated and if so query user info.
    */

    $check_sql = "SELECT BannerID, firstname, lastname"
    . " FROM myTable"
    . " WHERE username = 'johnsmith' ";

    sc_lookup(rs, $check_sql);

    if (isset({rs[0][0]})) // Row found
    {
    {bannerID} = {rs[0][0]};
    {firstname} = {rs[0][1]};
    {lastname} = {rs[0][2]};

    // Redirection parameters
    $redir_app = 'showApps'; // Application name
    $redir_target = '_blank';
    $redir_param = array(
    'bannerID' => '{bannerID}',
    'firstname' => '{firstname}',
    'lastname' => '{lastname}'
    );

    sc_redir($redir_app, bannerID = '{bannerID}', $redir_target);

    }
    else // No row found
    {
    $error_message = 'Record not found. Please contact the system administrator.'; // Error message
    sc_error_message($error_message);
    }

  • #2
    Re: blank application with redirect not working

    Hello,

    In which event are you trying to redirect your application?

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      Re: blank application with redirect not working

      I created a php method called checkUser then in onExecute I put the line: checkUser();

      Comment


      • #4
        Re: blank application with redirect not working

        Hello,

        Just for test purpose, could you add a echo before the sc_redir so we can make sure that it isn't an unreachable code? In addition, instead of using sc_redir could you use header( 'Location: http://www.google.com' ) ;

        regards,
        Bernhard Bernsmann

        Comment


        • #5
          Re: blank application with redirect not working

          - The echo before the sc_redir worked just fine.
          - Using header( 'Location: http://www.google.com' ) ; instead of sc_redir worked also just fine.
          - Trying sc_redir('http://www.google.com'); simply does not work.

          Is this a bug with sc_redir? I am using v. 6.

          Also: I changed the application setting and turned debugger on, that displays my SQL and it is just fine.

          Comment


          • #6
            Re: blank application with redirect not working

            Hello,

            I have also run a few tests and I do believe it is a bug. For now, keep using header to redirect to any other website. I have just reported this issue to our bugs team for further testing.

            regards,
            Bernhard Bernsmann

            Comment


            • #7
              Re: blank application with redirect not working

              Bernhard, thanks for all your help on this one.

              Now, how do you use the 'location' parameter using 'header'? If I put the application name (eg. 'showStudents.php'), header does not know where to find that application. Is there a built-in path variable that I can use that points to the application location?

              Comment


              • #8
                Re: blank application with redirect not working

                Hello,

                You could look under View --> Data in Session --> if there is such variable. If not, the alternative would be to create a global variable, and set the path to applications in it.

                regards,
                Bernhard Bernsmann

                Comment

                Working...
                X