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

Help!

Expand Messages
  • Eric Draven
    I have an idea for a freeware perl script that would be useful to just about anyone working on a project on the internet with lots of people from all over the
    Message 1 of 7 , Jan 31, 2001
    • 0 Attachment
      I have an idea for a freeware perl script that would be useful to
      just about anyone working on a project on the internet with lots of
      people from all over the country. And I have no idea where to begin.

      It's a script that creates and maintains an online community with
      seperate scripts for brainstorming, outline of the project, and a
      message board. If anyone can help me with the design and/or coding of
      this script, please let me know.

      I'd like it to be freeware/open source.


      -Moonlight Embrace
    • Jeremiah Megie
      Can someone tell me why this script doesn t work. Everything works except, when it gets to the telnet section, it automatically prints the done screen, but
      Message 2 of 7 , Jun 3, 2001
      • 0 Attachment
        Can someone tell me why this script doesn't work. Everything works except,
        when it gets to the telnet section, it automatically prints the "done"
        screen, but it never seems to actually run the telnet sub section.
        Everytime I run the script, I look at the mail server and the user hasn't
        been created...If I run the commands by hand, it's fine.

        Jeremiah


        #!/usr/bin/perl

        use Net::Telnet;

        print "Content-type: text/html\n\n";
        print "<html><head>\n";
        print "<link href=\"http://www.DOMAIN.COM/includes/main.css\"
        rel=\"stylesheet\" type=\"text/css\">\n";
        print "</head><body bgcolor=\"#FFFFFF\">\n";
        print "<center><p> </p>\n";

        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        @pairs = split(/&/, $buffer);

        foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $value =~ s/<([^>]|\n)*>//g;
        $value =~ s/<//g;
        $value =~ s/>//g;
        $FORM{$name} = $value;
        }

        &blank_response unless $FORM{'euser'};
        &blank_response unless $FORM{'epass'};
        &blank_response unless $FORM{'origemail'};
        &blank_response unless $FORM{'fname'};
        &blank_response unless $FORM{'lname'};

        if ($FORM{$name} =~ /^[\@0-9A-Za-z.-]+$/) {}
        else {
        print "$FORM{$name} contains an invalid character.\n";
        print "Please hit your back button on your browser and\n";
        print "choose a valid username. Usernames can only consist\n";
        print "of letters and/or numbers\n";
        exit;
        }

        $chkeuser = $FORM{'euser'};
        $exist = `rsh mail grep "$chkeuser:" /etc/passwd`;

        if ($exist) {&dup_euser}
        sub dub_euser {
        print "You have picked a username that already exists. Please hit your\n";
        print "back button try a different username.\n";
        exit;
        }

        $chkeuser2 = $FORM{'origemail'};
        $exist2 = `rsh mail grep "$chkeuser2:" /etc/passwd`;

        if ($exist2) {&create_email}
        else {
        print "<center><p> </p>\n";
        print "The original email address you specified
        <b>$FORM{'origemail'}\@...</b> does\n";
        print "not seem to be on our mail server.<br> Please check that the
        spelling\n";
        print "is correct. If you feel that this is an error, please
        contact\n";
        print "our techincal support.</center>\n";
        exit;
        }

        sub create_email {
        $host = 'SERVER.DOMAIN.COM';
        $username = 'USERNAME';
        $passwd = 'PASSWORD';
        $t = Net::Telnet->new( Timeout => 10,
        Host => $host,);
        $t->login($username, $passwd);
        $t->telnetmode('0');
        $t->waitfor(/#/i);
        $t->print("createmail.pl $FORM{'euser'} $FORM{'epass'} $FORM{'fname'}
        $FORM{'lname'}");
        $t->waitfor(/#/i);
        $t->close;
        }

        print "Your new email account <b>$FORM{'euser'}\@...</b> has been
        created.\n";
        print "<br>\n";
        print "<a class=\"norm\" href=\"http://www.DOMAIN.COM\">Click here</a>\n";
        print "to find instructions on setting up your new email account on your
        computer.\n";

        sub blank_response {
        print "It appears that you have left a field blank.\n";
        print "Please click your back button and fill out all of the fields.\n";
        exit;
        }

        print "</center></body></html>\n";

        exit;





        _______________________________________________________
        Send a cool gift with your E-Card
        http://www.bluemountain.com/giftcenter/
      • socia_rollingrockranch
        Hi, I was so excited when I found this list. I truely hope it is for beginners. I can t get started! I m trying to learn on my machine, i.e. everything on
        Message 3 of 7 , Mar 18, 2002
        • 0 Attachment
          Hi,

          I was so excited when I found this list. I truely hope it is for
          beginners. I can't get started! I'm trying to learn on my machine,
          i.e. everything on my C drive. I'm using Windows NT at work and 98
          at home. Nothing works and I think it's because I am not telling the
          file where my program is?

          My file is located on my C:\Perl\bin\ This is where my .exe files
          are. Could anyone take pity on my and tell me how to set the first
          line in my .pl files to direct it to the right place.

          THANK YOU IN ADVANCE!

          Sandie
          (wannabe Perl programmer!_
        • Kyle Hamar
          Sandie, Try the following; === #!c://perl/bin/perl -w print Content-type: text/html n n ; print Hello! n ; === The first line of this
          Message 4 of 7 , Mar 18, 2002
          • 0 Attachment
            Sandie,
            Try the following;

            ===

            #!c://perl/bin/perl -w

            print "Content-type: text/html\n\n";
            print "<html><h1>Hello!</h1></html>\n";

            ===

            The first line of this code should be added to all of your perl scripts in
            windows. Note that this will probably change when ported to your web server.

            Kyle

            PS: I like LEO SKIPS GAL


            At 09:42 PM 3/18/2002 +0000, you wrote:
            >Hi,
            >
            >I was so excited when I found this list. I truely hope it is for
            >beginners. I can't get started! I'm trying to learn on my machine,
            >i.e. everything on my C drive. I'm using Windows NT at work and 98
            >at home. Nothing works and I think it's because I am not telling the
            >file where my program is?
            >
            >My file is located on my C:\Perl\bin\ This is where my .exe files
            >are. Could anyone take pity on my and tell me how to set the first
            >line in my .pl files to direct it to the right place.
            >
            >THANK YOU IN ADVANCE!
            >
            >Sandie
            >(wannabe Perl programmer!_
          • Sandie Socia
            Kyle, Thanks for the help. I followed your instructions and opened Perl, typed in perl test1.pl (my file with your code), hit enter and nothing happens. I ve
            Message 5 of 7 , Mar 19, 2002
            • 0 Attachment
              Kyle,

              Thanks for the help.

              I followed your instructions and opened Perl, typed in
              perl test1.pl (my file with your code), hit enter and
              nothing happens. I've installed and reinstalled Perl
              and I know there is something really simple I'm not
              doing. Any other suggestions? My sample files are in
              the same directory as my exe file.

              Leo Skip's Gal is a nice Mare. She will be bred this
              year to my Stallion. I can't wait!

              Sandie

              =====
              Sandie Socia
              www.rollingrockranch.com

              __________________________________________________
              Do You Yahoo!?
              Yahoo! Sports - live college hoops coverage
              http://sports.yahoo.com/
            • Ken Arck
              I m dealing with log files where each line starts with a date in the format: mm/dd/yy. There are many lines for each date and many different dates. Log entries
              Message 6 of 7 , Apr 27, 2002
              • 0 Attachment
                I'm dealing with log files where each line starts with a date in the
                format: mm/dd/yy. There are many lines for each date and many different
                dates. Log entries look like this:

                04/25/02 , 10:22:22 , 50.0, F , 99.99, MPH, South ,180.0 , 0


                I'm trying to figure out how to parse the file looking for a particular
                date that is only contained in a scalar. In other words, I know all about
                reading a CSV file and building an array with each field contained in a
                element, so no problem there. What is the problem is that this process will
                be automated, so it must be able to extract log entries based on
                yesterday's date, which will be figured by the perl script and held in a
                scalar. I have the rest of the code done though.

                What I haven't figured out is how to use a scalar (variable?) in a regular
                expression search with which to parse the file looking for yesterday's date.

                Ken
              • Ken Arck
                ...
                Message 7 of 7 , Apr 27, 2002
                • 0 Attachment
                  ><sarcasm>
                  >Great subject, Ken. Very descriptive.
                  ></sarcasm>

                  <---Sorry about that. :)

                  >What form is the date in the scalar? Is it a serial or a date
                  >formatted to mm/dd/yy?

                  I'm extracting using the usual method:

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

                  and then formatting in various ways in order to build HTML. Then, I'm
                  building yesterday's date with:

                  $yesterday = time() - ( 24 * 60 * 60 );

                  ($ysec,$ymin,$yhour,$ymday,$ymon,$yyear,$ywday,$yday,$yisdst) =
                  localtime($yesterday);

                  The logfile I'm wanting to parse has multiple lines, each in the format below:

                  04/25/02 , 10:22:22 , 50.0, F , 99.99, MPH, South ,180.0 , 0


                  >I can't give you much more without some code. Can you
                  >show what you tried so far? And what is in the scalar?

                  The code is a bit much to post line-by-line. I've attached the
                  file...zipped of course :)

                  It's not the most elegant and it's far from done. I've been working on HTML
                  formatting in the code as well, but that's an easily ignored issue, as my
                  main problem is the log parsing for lines with yesterday's date.

                  If you need, I can explain what I am trying to do (if you can't figure it
                  out from the code <g>).

                  Thanks in advance,

                  Ken



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