CGI Genious

Discussion in 'General Discussion Forum' started by Smackrazor, Jan 23, 2000.

  1. Smackrazor

    Smackrazor Guest

    I haven't had the time to learn CGI, but I need to put a counter on my site. Will any CGI geniouses out there help me?

    I know it is something like this (not quite sure):

    #!/usr/local/bin/bash

    cd [directory where this script resides among with the "counters" and "pic" directories]

    CNT_NAME=`echo $DOCUMENT_NAME | cut -d'.' -f1 | cut -d'/' -f7-8`

    CNT=`cat counters/$CNT_NAME`
    echo $CNT+1 | bc >counters/$CNT_NAME
    CNT=`cat counters/$CNT_NAME`

    for i in `echo $CNT | sed -e 's/\([0-9]\)/\1 /g'`
    do
    echo -n "<IMG SRC=\"pic/$i.gif\" ALIGN=MIDDLE ALT=\"$i\">"
    done

    exit 0


    http://www.pipboy2000le.f2s.com/cautious.jpg

    Smackrazor
    Webmaster of http://www.pipboy2000le.f2s.com/
    Co-webmaster of http://diepokeman.virtualave.net/
     
  2. Guest

    Guest Guest

    Hoboy...

    Hoboy, now you'll start using this board for CGI.

    Smack, that isn't CGI, that's Perl. CGI stands for "Common Gateway Interface" which is simply a way for programs to be executed via the web. CGI programs can be binary executables or scripts (like the one below).

    #1) Do you have the path to perl correct?

    #2) Are you in the cgi-bin or other executing directory?

    #3) Is the file CHMODDED to actually be executable?

    -Xotor-

    >I haven't had the time to
    >learn CGI, but I need
    >to put a counter on
    >my site. Will any CGI
    >geniouses out there help me?
    >
    >
    >I know it is something like
    >this (not quite sure):
    >
    >#!/usr/local/bin/bash
    >
    >
    > cd [directory where
    >this script resides among with
    >the "counters" and "pic" directories]
    >
    >
    >
    > CNT_NAME=`echo $DOCUMENT_NAME |
    >cut -d'.' -f1 | cut
    >-d'/' -f7-8`
    >
    >
    > CNT=`cat counters/$CNT_NAME`
    > echo $CNT+1 | bc >counters/$CNT_NAME
    >
    > CNT=`cat counters/$CNT_NAME`
    >
    >
    > for i in
    >`echo $CNT | sed -e
    >'s/\([0-9]\)/\1 /g'`
    >
    > do
    > echo -n "<IMG SRC=\"pic/$i.gif\" ALIGN=MIDDLE ALT=\"$i\">"
    >
    > done
    >
    >
    > exit 0
    >
    >
    >http://www.pipboy2000le.f2s.com/cautious.jpg
    >
    >Smackrazor
    >Webmaster of http://www.pipboy2000le.f2s.com/
    >Co-webmaster of http://diepokeman.virtualave.net/




    [div align=center][hr]
    Hi! I'm a signature virus! Copy and paste me into your signature box to help me spread![/div]
     
  3. Smackrazor

    Smackrazor Guest

    I'm neither a ho, nore a boy!

    Anyway, I have no idea what to do with it. It is supposed to be a hit counter, but I don't have the fuggiest of ideas as to how to set it up!
    >Hoboy, now you'll start using this
    >board for CGI.
    >
    >Smack, that isn't CGI, that's Perl.
    > CGI stands for "Common
    >Gateway Interface" which is simply
    >a way for programs to
    >be executed via the web.
    > CGI programs can be
    >binary executables or scripts (like
    >the one below).
    >
    >#1) Do you have the path
    >to perl correct?
    >
    >#2) Are you in the cgi-bin
    >or other executing directory?
    >
    >#3) Is the file CHMODDED to
    >actually be executable?
    >
    >-Xotor-
    >>
    >>#!/usr/local/bin/bash
    >>
    >>
    >> cd [directory where
    >>this script resides among with
    >>the "counters" and "pic" directories]
    >>
    >>
    >>
    >> CNT_NAME=`echo $DOCUMENT_NAME |
    >>cut -d'.' -f1 | cut
    >>-d'/' -f7-8`
    >>
    >>
    >> CNT=`cat counters/$CNT_NAME`
    >> echo $CNT+1 | bc >counters/$CNT_NAME
    >>
    >> CNT=`cat counters/$CNT_NAME`
    >>
    >>
    >> for i in
    >>`echo $CNT | sed -e
    >>'s/\([0-9]\)/\1 /g'`
    >>
    >> do
    >> echo -n "<IMG SRC=\"pic/$i.gif\" ALIGN=MIDDLE ALT=\"$i\">"
    >>
    >> done
    >>
    >>
    >> exit 0
    >>

    http://www.pipboy2000le.f2s.com/geckoskinning.jpg

    Smackrazor
    Webmaster of http://www.pipboy2000le.f2s.com/
    Co-webmaster of http://diepokeman.virtualave.net/
     
  4. Brother None

    Brother None This ghoul has seen it all
    Staff Member Admin Orderite

    Apr 3, 2003
  5. Smackrazor

    Smackrazor Guest

  6. Brother None

    Brother None This ghoul has seen it all
    Staff Member Admin Orderite

    Apr 3, 2003
    But...

    NedStat is international! I have a Dutch counter at NPA (because I don't want anyone else to know what's going on:), a United Kingdom counter at Guns and Bullets and a United States counter at Randall Flagg's library. Just drop by the adress I give you, you'll see, you can select from several languages and time zones.

    >I use webaliser, but I want
    >something on display which everyone
    >who can read numbers will
    >understand. (I can't read Dutch,
    >so I don't have the
    >fuggiest of ideas as to
    >whats going on in your
    >sites!).
    >
    >http://www.pipboy2000le.f2s.com/science.jpg
    >
    >Smackrazor
    >Webmaster of http://www.pipboy2000le.f2s.com/
    >Co-webmaster of http://diepokeman.virtualave.net/


    -Kharn, you know the rest
    chiefkharn@hotmail.com
    http://gunsandbullets.cjb.net
     
  7. Brother None

    Brother None This ghoul has seen it all
    Staff Member Admin Orderite

    Apr 3, 2003
  8. Smackrazor

    Smackrazor Guest

  9. Guest

    Guest Guest

    "Nor" you mean?

    >Anyway, I have no idea what
    >to do with it. It
    >is supposed to be a
    >hit counter, but I don't
    >have the fuggiest of ideas
    >as to how to set
    >it up!

    Smackrazor, if you don't even know your path to Perl or even what CHMOD is there is no help for you. Read up on this kind of stuff because it is a FUNDAMENTAL PART of perl scripts.

    -Xotor-

    >>
    >>Smack, that isn't CGI, that's Perl.
    >> CGI stands for "Common
    >>Gateway Interface" which is simply
    >>a way for programs to
    >>be executed via the web.
    >> CGI programs can be
    >>binary executables or scripts (like
    >>the one below).
    >>
    >>#1) Do you have the path
    >>to perl correct?
    >>
    >>#2) Are you in the cgi-bin
    >>or other executing directory?
    >>
    >>#3) Is the file CHMODDED to
    >>actually be executable?
    >>
    >>-Xotor-
    >>>
    >>>#!/usr/local/bin/bash
    >>>
    >>>
    >>> cd [directory where
    >>>this script resides among with
    >>>the "counters" and "pic" directories]
    >>>
    >>>
    >>>
    >>> CNT_NAME=`echo $DOCUMENT_NAME |
    >>>cut -d'.' -f1 | cut
    >>>-d'/' -f7-8`
    >>>
    >>>
    >>> CNT=`cat counters/$CNT_NAME`
    >>> echo $CNT+1 | bc >counters/$CNT_NAME
    >>>
    >>> CNT=`cat counters/$CNT_NAME`
    >>>
    >>>
    >>> for i in
    >>>`echo $CNT | sed -e
    >>>'s/\([0-9]\)/\1 /g'`
    >>>
    >>> do
    >>> echo -n "<IMG SRC=\"pic/$i.gif\" ALIGN=MIDDLE ALT=\"$i\">"
    >>>
    >>> done
    >>>
    >>>
    >>> exit 0
    >>>
    >
    >http://www.pipboy2000le.f2s.com/geckoskinning.jpg
    >
    >Smackrazor
    >Webmaster of http://www.pipboy2000le.f2s.com/
    >Co-webmaster of http://diepokeman.virtualave.net/




    [div align=center][hr]
    Hi! I'm a signature virus! Copy and paste me into your signature box to help me spread![/div]
     
  10. Guest

    Guest Guest

    Where do you get these pics anyways!?

    >http://www.pipboy2000le.f2s.com/demon.jpg


    Don't tell me there's actually a Spawn spoof like that in FO2! (I've yet to play the game, so I'd have to believe anything anyone would say on the matter)
     
  11. Smackrazor

    Smackrazor Guest

    Well...

    [font size=1" color="#FF0000]LAST EDITED ON Jan-24-00 AT 05:28AM (GMT)[p]There are plenty of spoofs in the game, i'll try not to ruin it too much for you. But anyway, here are some:

    http://www.pipboy2000le.f2s.com/dermalimpactarmor.jpg
    Terminator

    http://www.pipboy2000le.f2s.com/demon.jpg
    Spawn

    http://www.pipboy2000le.f2s.com/flowerpower.jpg
    Hippies

    http://www.pipboy2000le.f2s.com/hulk.jpg
    Hulk

    http://www.pipboy2000le.f2s.com/lifegiver.jpg
    Jesus

    http://www.pipboy2000le.f2s.com/psycho.jpg
    Freddie Crougar, plus other freaks

    And the list goes on for ever and ever and ever.

    I think I accidentaly stumbled across a way to add html:
    [font color=red][blink]
    HTML[/blink]
    Smackrazor
    Webmaster of http://www.pipboy2000le.f2s.com/
    Co-webmaster of http://diepokeman.virtualave.net/
     
  12. Smackrazor

    Smackrazor Guest

    I know...

    >Smackrazor, if you don't even know
    >your path to Perl or
    >even what CHMOD is there
    >is no help for you.
    > Read up on this
    >kind of stuff because it
    >is a FUNDAMENTAL PART of
    >perl scripts.
    >
    >-Xotor-

    I think I know what CHMOD is roughly, it is to do with unix servers, and it is something to do with perl scripts.

    [font color=silver]BTW, Spanish has messed up my spelling.


    [font color=red]Smackrazor
    Webmaster of http://www.pipboy2000le.f2s.com/
    Co-webmaster of http://diepokeman.virtualave.net/
     
  13. Guest

    Guest Guest

    Okay... thanks. n/t

    There is no text here. Please go away or I'll call the cops.
     
  14. Guest

    Guest Guest

    RE: I know...

    >>Smackrazor, if you don't even know
    >>your path to Perl or
    >>even what CHMOD is there
    >>is no help for you.
    >> Read up on this
    >>kind of stuff because it
    >>is a FUNDAMENTAL PART of
    >>perl scripts.
    >>
    >>-Xotor-
    >
    >I think I know what CHMOD
    >is roughly, it is to
    >do with unix servers, and
    >it is something to do
    >with perl scripts.

    Well of course you could infer that CHMOD has to do with Perl scripts from my reply. No, CHMOD is not Perl-specific. However you use it ON perl scripts to make them executable.

    I'd suggest you just look up the terms on the net because you shouldn't be creating a website if you don't even know the fundamentals of CGI and the servers.

    >[font color=silver]BTW, Spanish has messed up
    >my spelling.

    You mean to say that you confused "Nor" with "Nore" pronounced Nor-AY in spanish?

    -Xotor-

    [div align=center][hr]
    Hi! I'm a signature virus! Copy and paste me into your signature box to help me spread![/div]
     
  15. Smackrazor

    Smackrazor Guest

    RE: I know...

    >>>Smackrazor, if you don't even know
    >>>your path to Perl or
    >>>even what CHMOD is there
    >>>is no help for you.
    >>> Read up on this
    >>>kind of stuff because it
    >>>is a FUNDAMENTAL PART of
    >>>perl scripts.
    >>>
    >>>-Xotor-
    >>
    >>I think I know what CHMOD
    >>is roughly, it is to
    >>do with unix servers, and
    >>it is something to do
    >>with perl scripts.
    >
    >Well of course you could infer
    >that CHMOD has to do
    >with Perl scripts from my
    >reply. No, CHMOD is
    >not Perl-specific. However you
    >use it ON perl scripts
    >to make them executable.
    >
    >I'd suggest you just look up
    >the terms on the net
    >because you shouldn't be creating
    >a website if you don't
    >even know the fundamentals of
    >CGI and the servers.

    Well, I haven't the faintest idea of how to use a UNIX server. And yet i'm trying to put some boards up on my site. Now isn't that strange?
    Hmmmm, I may even get to be able to get it working!

    >>[font color=silver]BTW, Spanish has messed up
    >>my spelling.
    >
    >You mean to say that you
    >confused "Nor" with "Nore" pronounced
    >Nor-AY in spanish?
    >
    No, I'm not saying that. Taking a foreign language (spanish) has messed up my English spelling.


    http://www.pipboy2000le.f2s.com/despair.jpg


    Smackrazor
    Webmaster: PIPBoy 2000 LE
    Co-webmaster: No Pokemon Allowed
     
  16. Roshambo

    Roshambo Antediluvian as Feck

    Apr 3, 2003
    ouch.....

    Here's a simple counter script out of my head for a text counter.

    counter.pl

    #!/usr/bin/perl/

    use CGI;
    $var = new CGI;
    open (COUNTER, ">data.txt");
    $number = <COUNTER>;
    close COUNTER;
    $number++;
    open (COUNTER,">data.txt");
    print COUNTER $number;
    close COUNTER;
    print "Number of page hits:" . $number;
     
  17. Smackrazor

    Smackrazor Guest

    Ouch?!

    I have no idea what that title meant, but oh well.
    >Here's a simple counter script out
    >of my head for a
    >text counter.
    >
    >counter.pl
    >
    >#!/usr/bin/perl/
    >
    >use CGI;
    >$var = new CGI;
    >open (COUNTER, ">data.txt");
    >$number = <COUNTER>;
    >close COUNTER;
    >$number++;
    >open (COUNTER,">data.txt");
    >print COUNTER $number;
    >close COUNTER;
    >print "Number of page hits:" .
    >$number;


    [TABLE border=5' cellspacing='0' cellpadding='15' bgcolor='#000000' bordercolor='#808080' bordercolorlight='#C0C0C0' bordercolordark='#000000][TR][TD]
    [TABLE border=0' cellspacing='0' cellpadding='0' bgcolor='#000000][TR][TD]
    [TD]
    [font face=arial, helvetica, ms sans serif" color="red][a href=mailto: ieatpokeman@hotmail.com]Smackrazor[/a]​
    [font face=arial, helvetica, ms sans serif" color="silver]Webmaster: http://www.pipboy2000le.f2s.com/"
    Co-webmaster: http://diepokemon.virtualave.net/[/TD][/TR]
    [/TABLE][/TD][/TR][/TABLE]
     
  18. Guest

    Guest Guest

    It means...

    >I have no idea what that
    >title meant, but oh well.

    It meant that the information should be so basic that everyone should know it already. It's kind of like hearing a person say "I know so little of the internet that I don't know what HTML is."

    -Xotor-

    [div align=center][hr]
    Hi! I'm a signature virus! Copy and paste me into your signature box to help me spread![/div]
     
  19. Smackrazor

    Smackrazor Guest

    Wha?!

    Urm, okay... I'll just step this way...

    I find it very easy to modify scripts, but I don't have any idea how to make one from scratch. But that is only with perl. I can use CSS and HTML if I start from scratch.

    >>I have no idea what that
    >>title meant, but oh well.
    >
    >It meant that the information should
    >be so basic that everyone
    >should know it already.
    >It's kind of like hearing
    >a person say "I know
    >so little of the internet
    >that I don't know what
    >HTML is."
    >
    >-Xotor-
    >
    >[div align=center][hr]
    >Hi! I'm a signature virus! Copy
    >and paste me into your
    >signature box to help me
    >spread![/div]


    [TABLE border=5' cellspacing='0' cellpadding='15' bgcolor='#000000' bordercolor='#808080' bordercolorlight='#C0C0C0' bordercolordark='#000000][TR][TD]
    [TABLE border=0' cellspacing='0' cellpadding='0' bgcolor='#000000][TR][TD]
    [TD]
    [font face=arial, helvetica, ms sans serif" color="red][a href=mailto: ieatpokeman@hotmail.com]Smackrazor[/a]​
    [font face=arial, helvetica, ms sans serif" color="silver]Webmaster: http://www.pipboy2000le.f2s.com/"
    Co-webmaster: http://diepokemon.virtualave.net/[/TD][/TR]
    [/TABLE][/TD][/TR][/TABLE]