Announcement

Collapse
No announcement yet.

Order counting script

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

    #16
    Here's the same thing done in Perl.
    Code:
    #!/usr/bin/perl
    # Configuration: look in Actinic / Advanced / Network Setup and do the following 2 changes
    # Set top line to be #!<Path to the Perl shell>       
    # Set following line to be $dir = '<Path From CGI-BIN to acatalog Directory>';
    $dir = '../acatalog/';
    print "content-type: text/html\n\n<head><title>Live Info: $dir</title></head><body>";
    print '<table bgcolor="#aaccee"><tr><td colspan=2><h3>' . (localtime time) . '</h3></td></tr>';
    opendir D, $dir; 
    @entries = readdir D;
    closedir D;
    $sess = $ord = $occ = 0;
    foreach $entry (@entries)
      {
      if ($entry =~ /\.ord$/){ $ord++ }
        elsif ($entry =~ /\.occ$/){ $occ++ }
          elsif ($entry =~ /\.session$/){ $sess++ }
      }
    print "<tr><td>Orders:</td><td>$ord</td></tr>";
    print "<tr><td>Occ Sessions:</td><td>$occ</td></tr>";
    print "<tr><td>Sessions:</td><td>$sess</td></tr>";
    print "</table></body></html>";
    Look in Actinic / Advanced / Network Setup and make the 2 changes as per the comments in the code above.
    Save the file as secretname.pl or secretname.cgi depending on your server (that suffix is in Advanced / Network Setup / Extension).
    Then FTP into your servers cgi-bin directory in ascii mode.
    Run the script via http://myserver.com/cgi-bin/secretname.pl
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #17
      s'not at all the same - it's blue!
      Web Design & Ecommerce - Affordable Web Hosting
      Free and low cost Merchant Accounts coming soon..
      NOD32 Antivirus - Reciprocal Links for Actinic Sites ONLY

      Comment


        #18
        Hi Greg and Norman,

        To be fair, it is a nice blue though.

        Thanks very much for the perl script Norman - it works a treat on my other sites!!

        Still trying to get Greg's working on my main site. If not possible, I'll email the details, thank you.

        Regards,
        David
        -----------------------------
        www.synchronisedwebdesign.com
        Location: North Yorkshire UK

        Comment


          #19
          I think I agree, blue looks quite nice and relaxing.
          Cheers,

          Ollie
          The Classic Network

          Comment


            #20
            I've just amended the code above slightly - - better layout - more nice blue.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #21
              I have now implemented this script on both my sites and added both pages to 1 single framed page so that I can monitor both sites at once.

              Many thanks to you both for this very useful script.
              Regards

              Jason

              Titan Jewellery (Swift Design)
              Zirconium Rings
              Damascus Steel Rings

              Comment


                #22
                Here's my patch rejigged to handle an arbitrary number of sites on the same server.
                Code:
                #!/usr/bin/perl
                # Configuration: look in Actinic / Advanced / Network Setup for the following 2 entries
                # Set top line to be #!<Path to the Perl shell>       
                # Set following line to be @dirs = ('<Path From CGI-BIN to acatalog Directory>');
                # If more than 1 site to monitor then use @dirs = ('<Path1>', '<Path2>', '<Path3>');
                @dirs = ('../acatalog/');
                print "content-type: text/html\n\n<head><title>Live Info</title></head><body>";
                print '<table bgcolor="#aaccee"><tr><td colspan=2><h3>' . (localtime time) . '</h3></td></tr>';
                foreach $dir (@dirs)
                  {
                  opendir D, $dir; 
                  @entries = readdir D;
                  closedir D;
                  $sess = $ord = $occ = 0;
                  foreach $entry (@entries)
                    {
                    if ($entry =~ /\.ord$/){ $ord++ }
                      elsif ($entry =~ /\.occ$/){ $occ++ }
                        elsif ($entry =~ /\.session$/){ $sess++ }
                    }
                  print "<tr bgcolor=\"#88aaee\"><td colspan=2><b>$dir</b></td></tr>";
                  print "<tr><td>Orders:</td><td>$ord</td></tr>";
                  print "<tr><td>Occ Sessions:</td><td>$occ</td></tr>";
                  print "<tr><td>Sessions:</td><td>$sess</td></tr>";
                  print "<tr><td colspan=2>&nbsp;</td></tr>";
                  }
                print "</table></body></html>";
                Look in Actinic / Advanced / Network Setup and make the 2 changes as per the comments in the code above.
                Save the file as secretname.pl or secretname.cgi depending on your server (that suffix is in Advanced / Network Setup / Extension).
                Then FTP into your servers cgi-bin directory in ascii mode.
                Run the script via http://myserver.com/cgi-bin/secretname.pl
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #23
                  if anyone is in doubt as to which script to use - mine, or the perl version from Norman, I highly recommend using the Perl version - shell can be disabled on certain hosts, or crippled by setting up users with a "restricted" shell - this prevents cd from working... which would stop my original script from functioning... it can be rewritten to include the folder in each of the ls commands, but even these can be crippled, so perl is DEFINITELY the better solution.

                  Which is ironic, as it's probably a LOT easier to mess up a system using a few choice perl scripts if you know what you're doing than using any practically any shell scripts... oh well... lots of web hosts REALLY don't know diddley...
                  Web Design & Ecommerce - Affordable Web Hosting
                  Free and low cost Merchant Accounts coming soon..
                  NOD32 Antivirus - Reciprocal Links for Actinic Sites ONLY

                  Comment


                    #24
                    And (like death and taxes) the one other thing you can be sure off, is that an Actinic site will have Perl available.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #25
                      lol - yes - or it won't be doing much business Norman!
                      Web Design & Ecommerce - Affordable Web Hosting
                      Free and low cost Merchant Accounts coming soon..
                      NOD32 Antivirus - Reciprocal Links for Actinic Sites ONLY

                      Comment


                        #26
                        I give up!
                        Despite idiot-proof instructions, I still can't get this to work!
                        Am using Normans perl version and saving as .pl, uploaded to my cgi bin.
                        Jo... if you're out there... what's wrong with the one I've uploaded? Am I a total idiot? (a question only to be answered by those "in the know" LOL)
                        Tracey
                        Tracey

                        Comment


                          #27
                          Did you set permissions on the uploaded file through your ftp program?
                          Bill
                          www.egyptianwonders.co.uk
                          Text directoryWorldwide Actinic(TM) shops
                          BC Ness Solutions Support services, custom software
                          Registered Microsoft™ Partner (ISV)
                          VoIP UK: 0131 208 0605
                          Located: Alexandria, EGYPT

                          Comment


                            #28
                            Originally posted by wjcampbe
                            Did you set permissions on the uploaded file through your ftp program?
                            I think so, yes!
                            I right clicked and selected "change file attributes" (using CuteFTP)
                            and checked ALL the boxes. Still didn't work.
                            When I went back in to see the settings again, however, all boxes were UNchecked?
                            DUnno...maybe even my website knows it's sunday!
                            Will tackle it when I have less to do, I guess.. along with my blooming Froggle submissions!
                            Tracey
                            Tracey

                            Comment


                              #29
                              Tracey,

                              When I uploaded mine I then had to select the file, right click and selet properties. Change the number in the permissions box to 755.
                              Regards

                              Jason

                              Titan Jewellery (Swift Design)
                              Zirconium Rings
                              Damascus Steel Rings

                              Comment


                                #30
                                Tracey

                                You can always let us know the URL of your script so we can see what's happening. Once it's fixed, rename it to something private.
                                Norman - www.drillpine.biz
                                Edinburgh, U K / Bitez, Turkey

                                Comment

                                Working...
                                X