Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] [#2] cgi progressive displaying script ?

Expand Messages
  • Kyle Hamar
    ... Try this and let me know if it works! ;-) === # Create a new instance of CGI my $query = new CGI; # Get the URL to which the user should be directed my
    Message 1 of 14 , Mar 3, 2002
      >
      > > Once that's done, print a redirect to new page.
      >
      >Can't figure out how to do that (yet). Any help appreciated.


      Try this and let me know if it works! ;-)

      ===

      # Create a new instance of CGI
      my $query = new CGI;

      # Get the URL to which the user should be directed
      my $target = "http://your.redirecturl.here/";

      # Now redirect to the target
      print $query->redirect($target);
    • msws_1
      ... #!/usr/bin/perl use CGI; $|=1; # Turn on autoflush print Content-type: text/html n n ; print ; print Please wait, processing. ; # file
      Message 2 of 14 , Mar 4, 2002
        > Try this and let me know if it works! ;-)

        OK, here's the changes and output. Still no redirect happening:
        --------------------------------------
        #!/usr/bin/perl
        use CGI;
        $|=1; # Turn on autoflush
        print "Content-type: text/html\n\n";
        print "<html><body>";
        print "Please wait, processing.";

        # file "stop" exists for this test...
        while (!-e "stop") {
        sleep 2;
        print " .";
        }

        print "<BR><BR>Done, processing......\n\n\n";
        print "</body></html><BR><BR>\n\n";

        # Create a new instance of CGI
        my $query = new CGI;

        # Get the URL to which the user should be directed
        my $target = "http://www.yahoo.com/";

        # Now redirect to the target
        print $query->redirect($target);

        exit;

        ----------------------------
        The result web page (source):
        ----------------------------
        <html><body>Please wait, processing.<BR><BR>Done, processing......


        </body></html><BR><BR>

        Status: 302 Moved
        Location: http://www.yahoo.com/
        ----------------------------

        Thanks again for the help.
        Scott
      • Franki
        I thought redirects didn t work if you have already printed a header? rgds Frank ... From: msws_1 [mailto:scott.list@mlec.net] Sent: Monday, 4 March 2002 11:04
        Message 3 of 14 , Mar 4, 2002
          I thought redirects didn't work if you have already printed a header?


          rgds

          Frank

          -----Original Message-----
          From: msws_1 [mailto:scott.list@...]
          Sent: Monday, 4 March 2002 11:04 PM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] [#2] cgi progressive displaying script ?


          > Try this and let me know if it works! ;-)

          OK, here's the changes and output. Still no redirect happening:
          --------------------------------------
          #!/usr/bin/perl
          use CGI;
          $|=1; # Turn on autoflush
          print "Content-type: text/html\n\n";
          print "<html><body>";
          print "Please wait, processing.";

          # file "stop" exists for this test...
          while (!-e "stop") {
          sleep 2;
          print " .";
          }

          print "<BR><BR>Done, processing......\n\n\n";
          print "</body></html><BR><BR>\n\n";

          # Create a new instance of CGI
          my $query = new CGI;

          # Get the URL to which the user should be directed
          my $target = "http://www.yahoo.com/";

          # Now redirect to the target
          print $query->redirect($target);

          exit;

          ----------------------------
          The result web page (source):
          ----------------------------
          <html><body>Please wait, processing.<BR><BR>Done, processing......


          </body></html><BR><BR>

          Status: 302 Moved
          Location: http://www.yahoo.com/
          ----------------------------

          Thanks again for the help.
          Scott







          Unsubscribing info is here:
          http://help.yahoo.com/help/us/groups/groups-32.html

          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        • msws_1
          ... header? Well, that s what I gathered as well from hunting info, but I a beginner at this (why I m here), and it would be nice if the redirect was
          Message 4 of 14 , Mar 4, 2002
            > I thought redirects didn't work if you have already printed a
            header?

            Well, that's what I gathered as well from hunting info, but I a
            beginner at this (why I'm here), and it would be nice if the redirect
            was automatic. Worst case, with Jonathon's original message, I took
            it to mean it was possible (msg# 9180).

            Worst case, since the "display as you go" is working, I can have a
            link presented after a forked program finishes for the user to click
            on for a redirect. Main thing was to get the "progressive" display
            happening which it is.

            But if there's a way to cause a redirect automatically, I'm all ears
            (fingers<g>).

            Thanks,
            Scott


            > OK, here's the changes and output. Progressive display working,
            No "automatic" redirect happening:
            > --------------------------------------
            > #!/usr/bin/perl
            > use CGI;
            > $|=1; # Turn on autoflush
            > print "Content-type: text/html\n\n";
            > print "<html><body>";
            > print "Please wait, processing.";
            >
            > # file "stop" exists for this test...
            > while (!-e "stop") {
            > sleep 2;
            > print " .";
            > }
            >
            > print "<BR><BR>Done, processing......\n\n\n";
            > print "</body></html><BR><BR>\n\n";
            >
            > # Create a new instance of CGI
            > my $query = new CGI;
            >
            > # Get the URL to which the user should be directed
            > my $target = "http://www.yahoo.com/";
            >
            > # Now redirect to the target
            > print $query->redirect($target);
            >
            > exit;
            >
            > ----------------------------
            > The result web page (source):
            > ----------------------------
            > <html><body>Please wait, processing.<BR><BR>Done, processing......
            >
            >
            > </body></html><BR><BR>
            >
            > Status: 302 Moved
            > Location: http://www.yahoo.com/
            > ----------------------------
          • Franki
            Hi people, I have a small problem that I was hoping someone can enlighten me with.. The regex below is supposed to untaint the $form_data{ cart_id } data and
            Message 5 of 14 , Mar 4, 2002
              Hi people,

              I have a small problem that I was hoping someone can enlighten me with..

              The regex below is supposed to untaint the $form_data{'cart_id'} data and
              get the $file_path
              var ready to be written to a file.. (in other words, $cart_id is a file
              name.)

              anyway, if I print out $file_path
              after this, I get this:
              /websites/resadmin/kv-e

              instead of this (which is what it should be):
              E:/websites/resadmin/kv-e/www/cgi-bin/kv-e/store/123.456

              (where 123.456 is the value of $cart_id)

              Here is the code.

              my $directory_path = 'E:/websites/resadmin/kv-e/www/cgi-bin/kv-e/store';

              $cart_id = $form_data{'cart_id'};
              $file_path = "$directory_path/${cart_id}.cart";
              $file_path =~ /([\w\-\=\+\/]+)\.(\w+)/;
              $file_path = "$1.$2";
              $file_path = "" if ($sc_cart_path eq ".");
              # Removed for NT/2000 version.
              #$sc_cart_path =~ s/^\/+//; # Get rid of any residual / prefix

              If I just do this:

              $sc_user_carts_directory_path = "$PaTh/shopping_carts";
              $sc_cart_path = "$sc_user_carts_directory_path/$cart_id";
              The script works.. so something in that regex is cutting most of the file
              path out..

              does anyone know what would be doing this?


              rgds

              Frank
            • Jeff 'japhy' Pinyan
              ... I get /websites/resadmin/kv-e/www/cgi-bin/kv-e/store/123.456 ... You don t allow : as a valid character. ... Include : in the character class: ($file_path)
              Message 6 of 14 , Mar 5, 2002
                On Mar 5, Franki said:

                >anyway, if I print out $file_path
                >/websites/resadmin/kv-e

                I get

                /websites/resadmin/kv-e/www/cgi-bin/kv-e/store/123.456

                >instead of this (which is what it should be):
                >E:/websites/resadmin/kv-e/www/cgi-bin/kv-e/store/123.456

                You don't allow : as a valid character.

                >my $directory_path = 'E:/websites/resadmin/kv-e/www/cgi-bin/kv-e/store';
                >
                >$cart_id = $form_data{'cart_id'};
                >$file_path = "$directory_path/${cart_id}.cart";
                >$file_path =~ /([\w\-\=\+\/]+)\.(\w+)/;

                Include : in the character class:

                ($file_path) = $file_path =~ m{([-\w=+/]+\.\w+)};

                --
                Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
                RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
                ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
                <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
                [ I'm looking for programming work. If you like my work, let me know. ]
              • Jason Larson
                ... ... Man, I really hate to correct Japhy, but looks like there might be a typo here... Did you mean to say: Include : in the character class:
                Message 7 of 14 , Mar 6, 2002
                  > -----Original Message-----
                  > From: Jeff 'japhy' Pinyan [mailto:japhy@...]
                  > Subject: Re: [PBML] regex giving incorrect result.
                  >
                  <snip>
                  >
                  > Include : in the character class:
                  >
                  > ($file_path) = $file_path =~ m{([-\w=+/]+\.\w+)};
                  >
                  > --
                  > Jeff "japhy" Pinyan japhy@...

                  Man, I really hate to correct Japhy, but looks like there might be a typo
                  here... Did you mean to say:

                  Include : in the character class:

                  ($file_path) = $file_path =~ m{([-:\w=+/]+\.\w+)};


                  Hope this helps (and I'm not sticking my proverbial foot in my mouth)...
                  Jason


                  CONFIDENTIALITY NOTICE:

                  ************************************************************************

                  The information contained in this ELECTRONIC MAIL transmission
                  is confidential. It may also be privileged work product or proprietary
                  information. This information is intended for the exclusive use of the
                  addressee(s). If you are not the intended recipient, you are hereby
                  notified that any use, disclosure, dissemination, distribution [other
                  than to the addressee(s)], copying or taking of any action because
                  of this information is strictly prohibited.

                  ************************************************************************


                  [Non-text portions of this message have been removed]
                • b_harnish
                  ... If I show this message to a friend, am I guilty of breaking the law? Am I an addressee(s)/intended recipient ? If not, then I just took an action because
                  Message 8 of 14 , Mar 6, 2002
                    --- In perl-beginner@y..., Jason Larson <jasonl@s...> wrote:
                    > CONFIDENTIALITY NOTICE:
                    >
                    > ************************************************************************
                    >
                    > The information contained in this ELECTRONIC MAIL transmission
                    > is confidential. It may also be privileged work product or proprietary
                    > information. This information is intended for the exclusive use of the
                    > addressee(s). If you are not the intended recipient, you are hereby
                    > notified that any use, disclosure, dissemination, distribution [other
                    > than to the addressee(s)], copying or taking of any action because
                    > of this information is strictly prohibited.
                    >
                    > ************************************************************************

                    If I show this message to a friend, am I guilty of breaking the law? Am I an "addressee(s)/intended recipient"? If not, then I just took an action because of the information above by replying to it. Technicaly, even if I am an "addressee(s)/intended recipient" I still took an action, but thats just splitting hairs.

                    CONFIDENTIALITY NOTICE:
                    *******************************************************
                    Reading the above message is strictly prohibited unless you are underwater while taking the aforementioned action. You will forget that this message even existed. Not complying with this notice is strictly prohibited. If you insist on reading the above message, you agree to the terms and conditions below:
                    I) You will wear pajama pants on only one leg for a week.
                    II) You will not critisize my spelling.
                    III) You waive all rights to naming your first born anything other than Brian.
                    IIII) You won't notice that this should be IV.
                    V) This thread was over before it started.
                    *******************************************************

                    - Brian
                  • Jeff 'japhy' Pinyan
                    ... Hahahahah. That was really silly of me. :) Thanks for including : in the character class, like I suggested but never DID. -- Jeff japhy Pinyan
                    Message 9 of 14 , Mar 6, 2002
                      On Mar 6, Jason Larson said:

                      >> From: Jeff 'japhy' Pinyan [mailto:japhy@...]
                      >>
                      >> Include : in the character class:
                      >>
                      >> ($file_path) = $file_path =~ m{([-\w=+/]+\.\w+)};
                      >
                      >Man, I really hate to correct Japhy, but looks like there might be a typo
                      >here... Did you mean to say:
                      >
                      > Include : in the character class:
                      >
                      > ($file_path) = $file_path =~ m{([-:\w=+/]+\.\w+)};

                      Hahahahah. That was really silly of me. :) Thanks for including : in the
                      character class, like I suggested but never DID.

                      --
                      Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
                      RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
                      ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
                      <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
                      [ I'm looking for programming work. If you like my work, let me know. ]
                    • Mike Payne
                      Redirects don t work if you ve finished the HTTP headers, try printing this to the browser: -Mike
                      Message 10 of 14 , Mar 9, 2002
                        Redirects don't work if you've finished the HTTP headers, try printing this
                        to the browser:

                        <meta http-equiv="refresh" content="0;http://www.yahoo.com/">


                        -Mike Payne
                        -----Original Message-----
                        From: Franki [mailto:frankieh@...]
                        Sent: Monday, March 04, 2002 10:14 AM
                        To: perl-beginner@yahoogroups.com
                        Subject: RE: [PBML] [#2] cgi progressive displaying script ?


                        I thought redirects didn't work if you have already printed a header?


                        rgds

                        Frank

                        -----Original Message-----
                        From: msws_1 [mailto:scott.list@...]
                        Sent: Monday, 4 March 2002 11:04 PM
                        To: perl-beginner@yahoogroups.com
                        Subject: Re: [PBML] [#2] cgi progressive displaying script ?


                        > Try this and let me know if it works! ;-)

                        OK, here's the changes and output. Still no redirect happening:
                        --------------------------------------
                        #!/usr/bin/perl
                        use CGI;
                        $|=1; # Turn on autoflush
                        print "Content-type: text/html\n\n";
                        print "<html><body>";
                        print "Please wait, processing.";

                        # file "stop" exists for this test...
                        while (!-e "stop") {
                        sleep 2;
                        print " .";
                        }

                        print "<BR><BR>Done, processing......\n\n\n";
                        print "</body></html><BR><BR>\n\n";

                        # Create a new instance of CGI
                        my $query = new CGI;

                        # Get the URL to which the user should be directed
                        my $target = "http://www.yahoo.com/";

                        # Now redirect to the target
                        print $query->redirect($target);

                        exit;

                        ----------------------------
                        The result web page (source):
                        ----------------------------
                        <html><body>Please wait, processing.<BR><BR>Done, processing......


                        </body></html><BR><BR>

                        Status: 302 Moved
                        Location: http://www.yahoo.com/
                        ----------------------------

                        Thanks again for the help.
                        Scott







                        Unsubscribing info is here:
                        http://help.yahoo.com/help/us/groups/groups-32.html

                        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


                        Yahoo! Groups Sponsor
                        ADVERTISEMENT




                        Unsubscribing info is here:
                        http://help.yahoo.com/help/us/groups/groups-32.html

                        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



                        [Non-text portions of this message have been removed]
                      Your message has been successfully submitted and would be delivered to recipients shortly.