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

see this imp problem about putting a comma if the next line is not a heading

Expand Messages
  • shoeb_jafri@hotmail.com
    Input: +1.8V ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1 C72.1 C64.1 C66.1 IC27.N13 IC27.N4 IC27.L3 IC27.B15 IC27.C6 IC27.D4 IC27.R15
    Message 1 of 13 , Mar 30, 2001
    • 0 Attachment
      Input:
      '+1.8V' ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1
      C72.1 C64.1 C66.1 IC27.N13 IC27.N4 IC27.L3 IC27.B15
      IC27.C6 IC27.D4 IC27.R15 IC27.A9 IC27.B2 IC27.D13
      IC28.R8 C104.1 C102.1 C106.1 L6.1 C105.1 C113.1 C110.1 C109.1
      C112.1 C111.1
      '+1.8VB' ; C26.1 C294.1 C25.1 C355.1 C24.1 C302.1 IC18.N9 IC18.N12
      IC18.P10 IC18.P15 IC18.R7 IC18.R14 IC18.AA1
      ..........................

      OUTPUT:
      '+1.8V' ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1,
      C72.1 C64.1 C66.1 IC27.N13 IC27.N4 IC27.L3 IC27.B15,
      IC27.C6 IC27.D4 IC27.R15 IC27.A9 IC27.B2 IC27.D13,
      IC28.R8 C104.1 C102.1 C106.1 L6.1 C105.1 C113.1 C110.1 C109.1,
      C112.1 C111.1
      '+1.8VB' ; C26.1 C294.1 C25.1 C355.1 C24.1 C302.1 IC18.N9 IC18.N12,
      IC18.P10 IC18.P15 IC18.R7 IC18.R14 IC18.AA1,
      ........................ , SINCE THERE R MORE LINES, I
      PUT A COMMA AT THE END OF THE LINE.
      IF A LINE START WITH ^' THEN THE LINE ONE BEFORE, SHOULD NOT HAVE A
      COMMA AT THE END OF THE LINE...AS U SEE TO THE OUTPUT..
      C112.1 C111.1 DOES NOT HAVE A COMMA AT THE END OF THE LINE SINCE THE
      NEXT LINE START WITH A ' SIGN.
      I HOPE U GUYS/GALS CAN HELP ON THIS ONE.
      THANKS
    • Greg
      ... THE ... ================== Simple. Just read the input data in one line at a time and add a comma to the end of each line. Save it all in some variable.
      Message 2 of 13 , Mar 30, 2001
      • 0 Attachment
        --- In perl-beginner@y..., shoeb_jafri@h... wrote:
        > Input:
        >SINCE THERE R MORE LINES, I
        > PUT A COMMA AT THE END OF THE LINE.
        > IF A LINE START WITH ^' THEN THE LINE ONE BEFORE, SHOULD NOT HAVE A
        > COMMA AT THE END OF THE LINE...AS U SEE TO THE OUTPUT..
        > C112.1 C111.1 DOES NOT HAVE A COMMA AT THE END OF THE LINE SINCE
        THE
        > NEXT LINE START WITH A ' SIGN.
        > I HOPE U GUYS/GALS CAN HELP ON THIS ONE.
        > THANKS
        ==================
        Simple. Just read the input data in one line at a time and add a
        comma to the end of each line. Save it all in some variable.
        Then globally replace every occurrance of /comma,end-of-line,'/
        with /end-of-line, '/

        Greg S.
      • shoeb_jafri@hotmail.com
        ... A ... Greg this is my input file............... +1.8V ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1 C72.1 C64.1 C66.1 IC27.N13 IC27.N4
        Message 3 of 13 , Mar 30, 2001
        • 0 Attachment
          --- In perl-beginner@y..., "Greg" <webmaster@b...> wrote:
          > --- In perl-beginner@y..., shoeb_jafri@h... wrote:
          > > Input:
          > >SINCE THERE R MORE LINES, I
          > > PUT A COMMA AT THE END OF THE LINE.
          > > IF A LINE START WITH ^' THEN THE LINE ONE BEFORE, SHOULD NOT HAVE
          A
          > > COMMA AT THE END OF THE LINE...AS U SEE TO THE OUTPUT..
          > > C112.1 C111.1 DOES NOT HAVE A COMMA AT THE END OF THE LINE SINCE
          > THE
          > > NEXT LINE START WITH A ' SIGN.
          > > I HOPE U GUYS/GALS CAN HELP ON THIS ONE.
          > > THANKS
          > ==================
          > Simple. Just read the input data in one line at a time and add a
          > comma to the end of each line. Save it all in some variable.
          > Then globally replace every occurrance of /comma,end-of-line,'/
          > with /end-of-line, '/
          >
          > Greg S.
          Greg this is my input file...............
          '+1.8V' ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1
          C72.1 C64.1 C66.1 IC27.N13 IC27.N4 IC27.L3 IC27.B15
          IC27.C6 IC27.D4 IC27.R15 IC27.A9 IC27.B2 IC27.D13
          IC27.F14 IC27.J15 IC27.P11 IC27.R2 IC27.R8
          L10.1 C65.1 C71.1 C67.1 C75.1 C70.1 C74.1 C68.1 IC31.N13 IC31.N4
          IC31.L3 IC31.B15 IC31.C6 IC31.D4 IC31.R15 IC31.A9
          IC31.B2 IC31.D13 IC31.F14 IC31.J15 IC31.P11
          IC31.R2 IC31.R8 C85.1 C94.1 C93.1 C90.1 C89.1 C86.1 C83.1
          L9.1 C87.1 C84.1 C88.1 C92.1 C91.1 C149.1 C145.1 C141.1 IC30.N13
          IC30.N4 IC30.L3 IC30.B15 IC30.C6 IC30.D4 IC30.R15
          IC30.A9 IC30.B2 IC30.D13 IC30.F14 IC30.J15 IC30.P11
          IC30.R2 IC30.R8 C150.1 C146.1 L8.1 C151.1 C148.1 C147.1 C144.1
          C143.1 C142.1 C140.1 C123.1 C127.1 C126.1 C121.1 IC29.N13 IC29.N4
          IC29.L3 IC29.B15 IC29.C6 IC29.D4 IC29.R15 IC29.A9
          IC29.B2 IC29.D13 IC29.F14 IC29.J15 IC29.P11
          IC29.R2 IC29.R8 C129.1 C125.1 C122.1 L7.1 C132.1 C128.1 C124.1
          C131.1 C130.1 C103.1 C107.1 C108.1 IC28.N13 IC28.N4 IC28.L3
          IC28.B15 IC28.C6 IC28.D4 IC28.R15 IC28.A9 IC28.B2
          IC28.D13 IC28.F14 IC28.J15 IC28.P11 IC28.R2
          IC28.R8 C104.1 C102.1 C106.1 L6.1 C105.1 C113.1 C110.1 C109.1
          C112.1 C111.1
          '+1.8VB' ; C26.1 C294.1 C25.1 C355.1 C24.1 C302.1 IC18.N9 IC18.N12
          IC18.P10 IC18.P15 IC18.R7 IC18.R14 IC18.AA1
          IC18.AA22 IC18.M22 IC18.B1 IC18.B22 IC18.H9
          IC18.J8 IC18.J13 IC18.K11 IC18.K14 IC18.L10
          IC18.M13 C293.1 L5.2 C419.1 IC59.3

          after running my code ..this is my output file:
          ,'+1.8V' ; R158.1 C301.1 C423.1 C413.1 C412.1 CR2.A R757.2 C73.1 C69.1
          ,C72.1 C64.1 C66.1 IC27.N13 IC27.N4 IC27.L3 IC27.B15
          ,IC27.C6 IC27.D4 IC27.R15 IC27.A9 IC27.B2 IC27.D13
          ,IC27.F14 IC27.J15 IC27.P11 IC27.R2 IC27.R8
          ,L10.1 C65.1 C71.1 C67.1 C75.1 C70.1 C74.1 C68.1 IC31.N13 IC31.N4
          ,IC31.L3 IC31.B15 IC31.C6 IC31.D4 IC31.R15 IC31.A9
          ,IC31.B2 IC31.D13 IC31.F14 IC31.J15 IC31.P11
          ,IC31.R2 IC31.R8 C85.1 C94.1 C93.1 C90.1 C89.1 C86.1 C83.1
          ,L9.1 C87.1 C84.1 C88.1 C92.1 C91.1 C149.1 C145.1 C141.1 IC30.N13
          ,IC30.N4 IC30.L3 IC30.B15 IC30.C6 IC30.D4 IC30.R15
          ,IC30.A9 IC30.B2 IC30.D13 IC30.F14 IC30.J15 IC30.P11
          ,IC30.R2 IC30.R8 C150.1 C146.1 L8.1 C151.1 C148.1 C147.1 C144.1
          ,C143.1 C142.1 C140.1 C123.1 C127.1 C126.1 C121.1 IC29.N13 IC29.N4
          ,IC29.L3 IC29.B15 IC29.C6 IC29.D4 IC29.R15 IC29.A9
          ,IC29.B2 IC29.D13 IC29.F14 IC29.J15 IC29.P11
          ,IC29.R2 IC29.R8 C129.1 C125.1 C122.1 L7.1 C132.1 C128.1 C124.1
          ,C131.1 C130.1 C103.1 C107.1 C108.1 IC28.N13 IC28.N4 IC28.L3
          ,IC28.B15 IC28.C6 IC28.D4 IC28.R15 IC28.A9 IC28.B2
          ,IC28.D13 IC28.F14 IC28.J15 IC28.P11 IC28.R2
          ,IC28.R8 C104.1 C102.1 C106.1 L6.1 C105.1 C113.1 C110.1 C109.1
          ,C112.1 C111.1
          ,'+1.8VB' ; C26.1 C294.1 C25.1 C355.1 C24.1 C302.1 IC18.N9 IC18.N12
          ,IC18.P10 IC18.P15 IC18.R7 IC18.R14 IC18.AA1
          ,IC18.AA22 IC18.M22 IC18.B1 IC18.B22 IC18.H9

          IT MEANS IT IS NOT WORKING PROPERLY..
          HERE IS MY CODE..
          while (<IN>){ #read a line from file IN into $_
          $newvar = "$_ ,";
          #print OUT $newvar;
          $newvar =~ s/,'/'/g;
          print OUT $newvar;
          }
          PLEASE LET ME KNOW WHAT IS WRONG .......
        • Greg
          ... You are not making allowance for end of line character. Try: while ( ){ #read a line from file IN into $_ $newvar = $_ ; chomp
          Message 4 of 13 , Apr 2, 2001
          • 0 Attachment
            --- In perl-beginner@y..., shoeb_jafri@h... wrote:
            > HERE IS MY CODE..
            > while (<IN>){ #read a line from file IN into $_
            > $newvar = "$_ ,";
            > #print OUT $newvar;
            > $newvar =~ s/,'/'/g;
            > print OUT $newvar;
            > }
            > PLEASE LET ME KNOW WHAT IS WRONG .......

            You are not making allowance for end of line character.

            Try:
            while (<IN>){ #read a line from file IN into $_
            $newvar = "$_";
            chomp ($newvar); #lose end-of-line
            $buffer=$buffer$newvar,\n"; #add comma, restore e-o-l
            } #and save in buffer

            $buffer=~ s/,/\n'//\n'/g; #replace ,e-o-l' with e-o-l'
            print OUT $buffer;
          • Franki
            Hi all, I have a question that is alot more relivent then most of mine :-) I have two scripts, one generates lots of html forms.. (called man.cgi) in one of
            Message 5 of 13 , Apr 2, 2001
            • 0 Attachment
              Hi all,

              I have a question that is alot more relivent then most of mine :-)

              I have two scripts, one generates lots of html forms.. (called man.cgi)
              in one of those forms, is a mini form that opens a popup window via JS and
              calls the second script in it.

              what I want to do, is have it so that the second script cannot be called on
              its own, it has to be called by man.cgi in the method above...

              I got no idea how to get it to do that.

              I thought maybe some way of checking refferer?


              can anyone make any suestions?


              kindest regards



              Frank Hauptle
              ----/ / _
              ---/ / (_)__ __ ____ __
              --/ /__/ / _ \/ // /\ \/ /
              -/____/_/_//_/\_,_/ /_/\_\
              Gshop & Network Payment Solutions.
            • Doug Wells
              You should be able to access the environmental variable HTTP_REFERER in the ENV hash. $ENV{ HTTP_REFERER } Good luck Doug ...
              Message 6 of 13 , Apr 2, 2001
              • 0 Attachment
                You should be able to access the environmental
                variable HTTP_REFERER in the ENV hash.

                $ENV{'HTTP_REFERER'}

                Good luck

                Doug

                --- Franki <frankieh@...> wrote:
                > Hi all,
                >
                > I have a question that is alot more relivent then
                > most of mine :-)
                >
                > I have two scripts, one generates lots of html
                > forms.. (called man.cgi)
                > in one of those forms, is a mini form that opens a
                > popup window via JS and
                > calls the second script in it.
                >
                > what I want to do, is have it so that the second
                > script cannot be called on
                > its own, it has to be called by man.cgi in the
                > method above...
                >
                > I got no idea how to get it to do that.
                >
                > I thought maybe some way of checking refferer?
                >
                >
                > can anyone make any suestions?
                >
                >
                > kindest regards
                >
                >
                >
                > Frank Hauptle
                > ----/ / _
                > ---/ / (_)__ __ ____ __
                > --/ /__/ / _ \/ // /\ \/ /
                > -/____/_/_//_/\_,_/ /_/\_\
                > Gshop & Network Payment Solutions.
                >
                >


                __________________________________________________
                Do You Yahoo!?
                Get email at your own domain with Yahoo! Mail.
                http://personal.mail.yahoo.com/?.refer=text
              • Franki
                yeah, I tried that, but because the script is printing a form with a onClick= window.open( ect ect ) that opens the second script in the popup window, the
                Message 7 of 13 , Apr 2, 2001
                • 0 Attachment
                  yeah, I tried that, but because the script is printing a form with a
                  onClick="window.open('ect ect')
                  that opens the second script in the popup window, the referer doesn't output
                  any results.

                  can I change the above so that it will work? (I'd like to keep the button,
                  instead of a html link if possible.)

                  regards

                  Frank Hauptle
                  ----/ / _
                  ---/ / (_)__ __ ____ __
                  --/ /__/ / _ \/ // /\ \/ /
                  -/____/_/_//_/\_,_/ /_/\_\
                  Gshop & Network Payment Solutions.

                  -----Original Message-----
                  From: Doug Wells [mailto:dougawells@...]
                  Sent: Tuesday, 3 April 2001 2:02 AM
                  To: perl-beginner@yahoogroups.com
                  Subject: Re: [PBML] Script security.


                  You should be able to access the environmental
                  variable HTTP_REFERER in the ENV hash.

                  $ENV{'HTTP_REFERER'}

                  Good luck

                  Doug

                  --- Franki <frankieh@...> wrote:
                  > Hi all,
                  >
                  > I have a question that is alot more relivent then
                  > most of mine :-)
                  >
                  > I have two scripts, one generates lots of html
                  > forms.. (called man.cgi)
                  > in one of those forms, is a mini form that opens a
                  > popup window via JS and
                  > calls the second script in it.
                  >
                  > what I want to do, is have it so that the second
                  > script cannot be called on
                  > its own, it has to be called by man.cgi in the
                  > method above...
                  >
                  > I got no idea how to get it to do that.
                  >
                  > I thought maybe some way of checking refferer?
                  >
                  >
                  > can anyone make any suestions?
                  >
                  >
                  > kindest regards
                  >
                  >
                  >
                  > Frank Hauptle
                  > ----/ / _
                  > ---/ / (_)__ __ ____ __
                  > --/ /__/ / _ \/ // /\ \/ /
                  > -/____/_/_//_/\_,_/ /_/\_\
                  > Gshop & Network Payment Solutions.
                  >
                  >


                  __________________________________________________
                  Do You Yahoo!?
                  Get email at your own domain with Yahoo! Mail.
                  http://personal.mail.yahoo.com/?.refer=text




                  Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                • Damien Carbery
                  How about some Javascript... something like the following in the code for the pop(ed) up window: if ( document.referer != http://www.... ) self.close();
                  Message 8 of 13 , Apr 2, 2001
                  • 0 Attachment
                    How about some Javascript... something like the following in the code
                    for the pop(ed) up window:

                    if ( document.referer != "http://www...." )
                    self.close(); // Close oneself.

                    I don't remember the exact commands, and you may want to do different
                    document.referer checks e.g. only search for a document name or a
                    portion of the domain name.

                    --- In perl-beginner@y..., "Franki" <frankieh@v...> wrote:
                    > yeah, I tried that, but because the script is printing a form with a
                    > onClick="window.open('ect ect')
                    > that opens the second script in the popup window, the referer
                    doesn't output
                    > any results.
                    >
                    > can I change the above so that it will work? (I'd like to keep the
                    button,
                    > instead of a html link if possible.)
                    >
                    > regards
                    >
                    > Frank Hauptle
                    > ----/ / _
                    > ---/ / (_)__ __ ____ __
                    > --/ /__/ / _ \/ // /\ \/ /
                    > -/____/_/_//_/\_,_/ /_/\_\
                    > Gshop & Network Payment Solutions.
                    >
                    > -----Original Message-----
                    > From: Doug Wells [mailto:dougawells@y...]
                    > Sent: Tuesday, 3 April 2001 2:02 AM
                    > To: perl-beginner@y...
                    > Subject: Re: [PBML] Script security.
                    >
                    >
                    > You should be able to access the environmental
                    > variable HTTP_REFERER in the ENV hash.
                    >
                    > $ENV{'HTTP_REFERER'}
                    >
                    > Good luck
                    >
                    > Doug
                    >
                    > --- Franki <frankieh@v...> wrote:
                    > > Hi all,
                    > >
                    > > I have a question that is alot more relivent then
                    > > most of mine :-)
                    > >
                    > > I have two scripts, one generates lots of html
                    > > forms.. (called man.cgi)
                    > > in one of those forms, is a mini form that opens a
                    > > popup window via JS and
                    > > calls the second script in it.
                    > >
                    > > what I want to do, is have it so that the second
                    > > script cannot be called on
                    > > its own, it has to be called by man.cgi in the
                    > > method above...
                    > >
                    > > I got no idea how to get it to do that.
                    > >
                    > > I thought maybe some way of checking refferer?
                    > >
                    > >
                    > > can anyone make any suestions?
                    > >
                    > >
                    > > kindest regards
                    > >
                    > >
                    > >
                    > > Frank Hauptle
                    > > ----/ / _
                    > > ---/ / (_)__ __ ____ __
                    > > --/ /__/ / _ \/ // /\ \/ /
                    > > -/____/_/_//_/\_,_/ /_/\_\
                    > > Gshop & Network Payment Solutions.
                    > >
                    > >
                    >
                    >
                    > __________________________________________________
                    > Do You Yahoo!?
                    > Get email at your own domain with Yahoo! Mail.
                    > http://personal.mail.yahoo.com/?.refer=text
                    >
                    >
                    >
                    >
                    > Your use of Yahoo! Groups is subject to
                    http://docs.yahoo.com/info/terms/
                  • Franki
                    yeah, I thought about that too, but basically, its to stop an upload script from being accessed from anyone not doing so through the other perl script, because
                    Message 9 of 13 , Apr 2, 2001
                    • 0 Attachment
                      yeah, I thought about that too,

                      but basically, its to stop an upload script from being accessed from anyone
                      not doing so through the other perl script, because the other perl script
                      has password and .htaccess protection and I thought it would be cool if the
                      script could itself determine from where it was accessed and if it wasn't
                      the other script it shouldn't work.

                      I suppose its not hugely important that it do that, because that script is
                      also protected by htaccess. but I am of the opinion that if I am paranoid
                      all the time, sooner or later it will be justified at least once.

                      I considered having the parent script set a cookie after login, and have the
                      second script detect that cookie and if its not present, to exit... but
                      again, thats not much better then the JS version. and has no functionality
                      if the user has cookies disabled.

                      so the last answer I came up with, is for the parent script to write the
                      users IP address to a file, and then when the child script is run, it tries
                      to match the IP address with the user trying to access the child script..

                      That is the best answer I could come up with failing a solution to the http
                      referer method.

                      Frank Hauptle
                      ----/ / _
                      ---/ / (_)__ __ ____ __
                      --/ /__/ / _ \/ // /\ \/ /
                      -/____/_/_//_/\_,_/ /_/\_\
                      Gshop & Network Payment Solutions.

                      -----Original Message-----
                      From: Damien Carbery [mailto:daymobrew@...]
                      Sent: Tuesday, 3 April 2001 2:20 AM
                      To: perl-beginner@yahoogroups.com
                      Subject: Re: [PBML] Script security.


                      How about some Javascript... something like the following in the code
                      for the pop(ed) up window:

                      if ( document.referer != "http://www...." )
                      self.close(); // Close oneself.

                      I don't remember the exact commands, and you may want to do different
                      document.referer checks e.g. only search for a document name or a
                      portion of the domain name.

                      --- In perl-beginner@y..., "Franki" <frankieh@v...> wrote:
                      > yeah, I tried that, but because the script is printing a form with a
                      > onClick="window.open('ect ect')
                      > that opens the second script in the popup window, the referer
                      doesn't output
                      > any results.
                      >
                      > can I change the above so that it will work? (I'd like to keep the
                      button,
                      > instead of a html link if possible.)
                      >
                      > regards
                      >
                      > Frank Hauptle
                      > ----/ / _
                      > ---/ / (_)__ __ ____ __
                      > --/ /__/ / _ \/ // /\ \/ /
                      > -/____/_/_//_/\_,_/ /_/\_\
                      > Gshop & Network Payment Solutions.
                      >
                      > -----Original Message-----
                      > From: Doug Wells [mailto:dougawells@y...]
                      > Sent: Tuesday, 3 April 2001 2:02 AM
                      > To: perl-beginner@y...
                      > Subject: Re: [PBML] Script security.
                      >
                      >
                      > You should be able to access the environmental
                      > variable HTTP_REFERER in the ENV hash.
                      >
                      > $ENV{'HTTP_REFERER'}
                      >
                      > Good luck
                      >
                      > Doug
                      >
                      > --- Franki <frankieh@v...> wrote:
                      > > Hi all,
                      > >
                      > > I have a question that is alot more relivent then
                      > > most of mine :-)
                      > >
                      > > I have two scripts, one generates lots of html
                      > > forms.. (called man.cgi)
                      > > in one of those forms, is a mini form that opens a
                      > > popup window via JS and
                      > > calls the second script in it.
                      > >
                      > > what I want to do, is have it so that the second
                      > > script cannot be called on
                      > > its own, it has to be called by man.cgi in the
                      > > method above...
                      > >
                      > > I got no idea how to get it to do that.
                      > >
                      > > I thought maybe some way of checking refferer?
                      > >
                      > >
                      > > can anyone make any suestions?
                      > >
                      > >
                      > > kindest regards
                      > >
                      > >
                      > >
                      > > Frank Hauptle
                      > > ----/ / _
                      > > ---/ / (_)__ __ ____ __
                      > > --/ /__/ / _ \/ // /\ \/ /
                      > > -/____/_/_//_/\_,_/ /_/\_\
                      > > Gshop & Network Payment Solutions.
                      > >
                      > >
                      >
                      >
                      > __________________________________________________
                      > Do You Yahoo!?
                      > Get email at your own domain with Yahoo! Mail.
                      > http://personal.mail.yahoo.com/?.refer=text
                      >
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to
                      http://docs.yahoo.com/info/terms/





                      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                    • Mike Payne
                      If someone really wanted to bypass it, they could just turn javascript off, especially considering the fact that unless the window was opened by a javascript
                      Message 10 of 13 , Apr 2, 2001
                      • 0 Attachment
                        If someone really wanted to bypass it, they could just turn javascript off,
                        especially considering the fact that unless the window was opened by a
                        javascript command(which it wouldn't be if they cut/pasted the url), it asks
                        for a confirmation to close the window, which you can just deny and then the
                        code is useless.

                        -Mike


                        -----Original Message-----
                        From: Damien Carbery [mailto:daymobrew@...]
                        Sent: Monday, April 02, 2001 2:20 PM
                        To: perl-beginner@yahoogroups.com
                        Subject: Re: [PBML] Script security.


                        How about some Javascript... something like the following in the code
                        for the pop(ed) up window:

                        if ( document.referer != "http://www...." )
                        self.close(); // Close oneself.

                        I don't remember the exact commands, and you may want to do different
                        document.referer checks e.g. only search for a document name or a
                        portion of the domain name.

                        --- In perl-beginner@y..., "Franki" <frankieh@v...> wrote:
                        > yeah, I tried that, but because the script is printing a form with a
                        > onClick="window.open('ect ect')
                        > that opens the second script in the popup window, the referer
                        doesn't output
                        > any results.
                        >
                        > can I change the above so that it will work? (I'd like to keep the
                        button,
                        > instead of a html link if possible.)
                        >
                        > regards
                        >
                        > Frank Hauptle
                        > ----/ / _
                        > ---/ / (_)__ __ ____ __
                        > --/ /__/ / _ \/ // /\ \/ /
                        > -/____/_/_//_/\_,_/ /_/\_\
                        > Gshop & Network Payment Solutions.
                        >
                        > -----Original Message-----
                        > From: Doug Wells [mailto:dougawells@y...]
                        > Sent: Tuesday, 3 April 2001 2:02 AM
                        > To: perl-beginner@y...
                        > Subject: Re: [PBML] Script security.
                        >
                        >
                        > You should be able to access the environmental
                        > variable HTTP_REFERER in the ENV hash.
                        >
                        > $ENV{'HTTP_REFERER'}
                        >
                        > Good luck
                        >
                        > Doug
                        >
                        > --- Franki <frankieh@v...> wrote:
                        > > Hi all,
                        > >
                        > > I have a question that is alot more relivent then
                        > > most of mine :-)
                        > >
                        > > I have two scripts, one generates lots of html
                        > > forms.. (called man.cgi)
                        > > in one of those forms, is a mini form that opens a
                        > > popup window via JS and
                        > > calls the second script in it.
                        > >
                        > > what I want to do, is have it so that the second
                        > > script cannot be called on
                        > > its own, it has to be called by man.cgi in the
                        > > method above...
                        > >
                        > > I got no idea how to get it to do that.
                        > >
                        > > I thought maybe some way of checking refferer?
                        > >
                        > >
                        > > can anyone make any suestions?
                        > >
                        > >
                        > > kindest regards
                        > >
                        > >
                        > >
                        > > Frank Hauptle
                        > > ----/ / _
                        > > ---/ / (_)__ __ ____ __
                        > > --/ /__/ / _ \/ // /\ \/ /
                        > > -/____/_/_//_/\_,_/ /_/\_\
                        > > Gshop & Network Payment Solutions.
                        > >
                        > >
                        >
                        >
                        > __________________________________________________
                        > Do You Yahoo!?
                        > Get email at your own domain with Yahoo! Mail.
                        > http://personal.mail.yahoo.com/?.refer=text
                        >
                        >
                        >
                        >
                        > Your use of Yahoo! Groups is subject to
                        http://docs.yahoo.com/info/terms/





                        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                      • Franki
                        yup, thats exactly why I caned that idea. I want it so that if the user tries to log directly into the child script, it checks to see where the user came from,
                        Message 11 of 13 , Apr 2, 2001
                        • 0 Attachment
                          yup, thats exactly why I caned that idea.

                          I want it so that if the user tries to log directly into the child script,
                          it checks to see where the user came from, and if not the parent script, it
                          exits. the two methods I know would work, would be the http referer, or
                          having the parent script write the users IP to file, and then require that
                          file in the child script and attempt to match IP's, if no match, then it
                          exits...



                          Frank Hauptle
                          ----/ / _
                          ---/ / (_)__ __ ____ __
                          --/ /__/ / _ \/ // /\ \/ /
                          -/____/_/_//_/\_,_/ /_/\_\
                          Gshop & Network Payment Solutions.

                          -----Original Message-----
                          From: Mike Payne [mailto:theseus@...]
                          Sent: Tuesday, 3 April 2001 2:24 AM
                          To: perl-beginner@yahoogroups.com
                          Subject: RE: [PBML] Script security.


                          If someone really wanted to bypass it, they could just turn javascript off,
                          especially considering the fact that unless the window was opened by a
                          javascript command(which it wouldn't be if they cut/pasted the url), it asks
                          for a confirmation to close the window, which you can just deny and then the
                          code is useless.

                          -Mike


                          -----Original Message-----
                          From: Damien Carbery [mailto:daymobrew@...]
                          Sent: Monday, April 02, 2001 2:20 PM
                          To: perl-beginner@yahoogroups.com
                          Subject: Re: [PBML] Script security.


                          How about some Javascript... something like the following in the code
                          for the pop(ed) up window:

                          if ( document.referer != "http://www...." )
                          self.close(); // Close oneself.

                          I don't remember the exact commands, and you may want to do different
                          document.referer checks e.g. only search for a document name or a
                          portion of the domain name.

                          --- In perl-beginner@y..., "Franki" <frankieh@v...> wrote:
                          > yeah, I tried that, but because the script is printing a form with a
                          > onClick="window.open('ect ect')
                          > that opens the second script in the popup window, the referer
                          doesn't output
                          > any results.
                          >
                          > can I change the above so that it will work? (I'd like to keep the
                          button,
                          > instead of a html link if possible.)
                          >
                          > regards
                          >
                          > Frank Hauptle
                          > ----/ / _
                          > ---/ / (_)__ __ ____ __
                          > --/ /__/ / _ \/ // /\ \/ /
                          > -/____/_/_//_/\_,_/ /_/\_\
                          > Gshop & Network Payment Solutions.
                          >
                          > -----Original Message-----
                          > From: Doug Wells [mailto:dougawells@y...]
                          > Sent: Tuesday, 3 April 2001 2:02 AM
                          > To: perl-beginner@y...
                          > Subject: Re: [PBML] Script security.
                          >
                          >
                          > You should be able to access the environmental
                          > variable HTTP_REFERER in the ENV hash.
                          >
                          > $ENV{'HTTP_REFERER'}
                          >
                          > Good luck
                          >
                          > Doug
                          >
                          > --- Franki <frankieh@v...> wrote:
                          > > Hi all,
                          > >
                          > > I have a question that is alot more relivent then
                          > > most of mine :-)
                          > >
                          > > I have two scripts, one generates lots of html
                          > > forms.. (called man.cgi)
                          > > in one of those forms, is a mini form that opens a
                          > > popup window via JS and
                          > > calls the second script in it.
                          > >
                          > > what I want to do, is have it so that the second
                          > > script cannot be called on
                          > > its own, it has to be called by man.cgi in the
                          > > method above...
                          > >
                          > > I got no idea how to get it to do that.
                          > >
                          > > I thought maybe some way of checking refferer?
                          > >
                          > >
                          > > can anyone make any suestions?
                          > >
                          > >
                          > > kindest regards
                          > >
                          > >
                          > >
                          > > Frank Hauptle
                          > > ----/ / _
                          > > ---/ / (_)__ __ ____ __
                          > > --/ /__/ / _ \/ // /\ \/ /
                          > > -/____/_/_//_/\_,_/ /_/\_\
                          > > Gshop & Network Payment Solutions.
                          > >
                          > >
                          >
                          >
                          > __________________________________________________
                          > Do You Yahoo!?
                          > Get email at your own domain with Yahoo! Mail.
                          > http://personal.mail.yahoo.com/?.refer=text
                          >
                          >
                          >
                          >
                          > Your use of Yahoo! Groups is subject to
                          http://docs.yahoo.com/info/terms/





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







                          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                        • Chanda Adams
                          is there a command that will simply add the date to a cgi script that will be emailed? I know it s on the email, but in the form would be handy. Thanks!
                          Message 12 of 13 , Apr 2, 2001
                          • 0 Attachment
                            is there a command that will simply add the date to a cgi script that will
                            be emailed? I know it's on the email, but in the form would be handy.

                            Thanks!
                            Chanda

                            --
                            Chanda Adams
                            adams@...
                          • Damien Carbery
                            #!/usr/local/bin/perl -w use strict; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = localtime(); $yday = sprintf( %02d:%02d:%02d %02d-%02d-%4d ,
                            Message 13 of 13 , Apr 2, 2001
                            • 0 Attachment
                              #!/usr/local/bin/perl -w

                              use strict;

                              my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) =
                              localtime();

                              $yday = sprintf( "%02d:%02d:%02d %02d-%02d-%4d", $hour, $min,
                              $sec, $mday, $mon, $year + 1900 );
                              print $yday;

                              __END__
                              I know the call to localtime() could be simplified.
                              I used sprintf() because I read it is more efficient than printf but,
                              of course, I can't find where I read this.

                              Now you have the info, you can print it with your CGI/HTML output as
                              normal.

                              --- In perl-beginner@y..., Chanda Adams <adams@g...> wrote:
                              >
                              > is there a command that will simply add the date to a cgi script
                              that will
                              > be emailed? I know it's on the email, but in the form would be
                              handy.
                              >
                              > Thanks!
                              > Chanda
                              >
                              > --
                              > Chanda Adams
                              > adams@g...
                            Your message has been successfully submitted and would be delivered to recipients shortly.