Files
harbour-core/harbour/contrib/htmllib/counter.prg
Przemyslaw Czerpak 25a8855970 2007-04-02 16:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/htmllib/counter.prg
  * harbour/contrib/htmllib/htmbrows.prg
  * harbour/contrib/htmllib/jwindow.prg
  * harbour/contrib/htmllib/ocgi.prg
  * harbour/contrib/htmllib/oedit.prg
  * harbour/contrib/htmllib/ofile.prg
  * harbour/contrib/htmllib/ohtm.prg
  * harbour/contrib/htmllib/oini.prg
  * harbour/contrib/libnf/aading.prg
  * harbour/contrib/libnf/aredit.prg
  * harbour/contrib/libnf/clrsel.prg
  * harbour/contrib/libnf/dispmsg.prg
  * harbour/contrib/libnf/eltime.prg
  * harbour/contrib/libnf/floptst.prg
  * harbour/contrib/libnf/menu1.prg
  * harbour/contrib/libnf/pegs.prg
  * harbour/contrib/libnf/popadder.prg
  * harbour/contrib/libnf/savesets.prg
  * harbour/contrib/libnf/tbwhile.prg
  * harbour/contrib/libnf/xbox.prg
  * harbour/contrib/odbc/todbc.prg
    * cleaned unused variable warnings
2007-04-02 14:40:49 +00:00

89 lines
1.7 KiB
Plaintext

#include "html.ch"
#include "forms.ch"
#include "default.ch"
PROC CounterCGI()
LOCAL lIsPost := .F.
LOCAL cCounterDat := "counter.dat"
LOCAL oFrm
LOCAL oHtm, oCgi
SET DATE BRITISH
IF "POST" $ UPPER(GETENV("REQUEST_METHOD"))
lIsPost := .T.
oCgi := oCGI():New() // get server parameters/variables
ENDIF
oHtm := HTML():CGINew( "Counter.htm", "My Counter File" )
oHtm:SetPageColor(CLR_DARK_YELLOW ) //"#FFFFCC")
oHtm:SetTextColor(CLR_WHITE)
oHtm:SetbgImage("/images/back/bg32.bmp")
oHtm:Setcenter( .f. )
oHtm:qout( "" )
SET FONT "Verdana" SIZE 3 OF oHtm
DEFINE FORM oFrm ;
CAPTION "A Simple Counter" ;
NAME "MyForm";
ACTION "/cgi-bin/counter.exe?" ;
FRAME
CONTROL EDIT NAME "User" ;
MAXCHARS 20 ;
SIZE 20 ;
CAPTION "User Name:" ;
IN oFrm
LINE BREAK IN oFrm
LINE IN oFrm
LINE BREAK IN oFrm
SPACE 80 IN oFrm
CONTROL SUBMIT NAME cSubmit VALUE (" Ok ") IN oFrm
ACTIVATE oFrm
SET FONT "Verdana" SIZE 3 OF oHtm
oHtm:defineTable( 2,, 90,, "#9196A0" )
oHtm:newTableRow()
oHtm:newTableCell()
oHtm:QOut( "Page Visited :<b>" + TRANSFORM( incCounter(), "999,999,999" ) + +htmlSpace(2)+"</b>Times")
oHtm:EndTableCell()
oHtm:EndTableRow()
oHtm:EndTable()
oHtm:cgiClose()
RETURN
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
FUNCTION IncCounter()
LOCAL n := 0
IF FILE("Counter.dat")
n := VAL(MEMOREAD("counter.dat"))
ELSE
n := 0
ENDIF
MEMOWRIT( "counter.dat", STR( n+1 ) )
RETURN n
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
FUNCTION GetCounter()
LOCAL n := 0
IF FILE("Counter.dat")
n := VAL(MEMOREAD("counter.dat"))
ELSE
incCounter()
ENDIF
RETURN n