home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1998 September
/
Sezamfile98_2.iso
/
VBasic
/
VB5-CGI.ZIP
/
demoHTML.ba_
/
demoHTML.ba
Wrap
Text File
|
1998-06-08
|
4KB
|
60 lines
Attribute VB_Name = "modHTML"
'VB5-CGI Objects script example: demoHTML.bas
'Copyright 1997, 1998 EazyWare - http://www.eazyware.com/vb5-cgi
'---------------------------------------------------------------
'Shows the basic functionalities of the VB5HTML object.
'---------------------------------------------------------------
Option Explicit
Private CGI As New VB5CGI.clsCGI 'Instance the VB5CGI Object (needs VB5CGI.DLL)
Private HTML As New VB5HTML.clsHTML 'Instance the VB5HTML Object (needs VB5HTML.DLL)
Sub Main()
With HTML
'Add an additional text (e.g. your e-mail address) to an occuring error message
.ErrorSubText = "Please, send your comments to " & .GetTextLink("EasyWare", "mailto:tools@eazyware.com")
.BodyFileHeader = "\demoHEAD.htm" 'Use a HTML header file
.BodyFileFooter = "\demoFOOT.htm" 'Use a HTML footer file
'Retrieve and check the query string (allow only POST-method and max 1024 not encoded characters)
If .InitQueryString(True, 1024) Then
'Validate the FirstName entry. Allow only US letters, Spaces, min 3 to max 25 characters
If Not .HasKeyValidStringContent("FirstName", htmlLetterUS + htmlSpace, 3, 25) Then
'If the entry was not valid, submit a simple information page
.SubmitPage "Validation", "Please enter your first name (US letters, Spaces, min 3 to max 25 characters)", True
End 'And end the script
End If
If Not .HasKeyValidStringLen("LastName", 2, 25) Then 'Validate the LastName entry
.SubmitPage "Validation", "Please enter your last name (2 to 25 characters)", True
End
End If
If Not .HasKeyValidIntegerRange("Age", 1, 150) Then 'Validate the Age entry
.SubmitPage "Validation", "Please enter your age (1 to 150 years)", True
End
End If
'Start the sample page with a title and background color
.PageBegin "VB5-CGI Objects demonstration [" & CGI.GetScriptName(True) & "]", "#FFFFCC"
.HeadMetaNameContent "Author", "James Bond" 'Add a meta tag
.BodyTag "H2", "Dear " & .GetKeyString("FirstName") & " " & _
.GetKeyString("LastName") & ", welcome to the VB5HTML demo!"
.BodyTextBI "Some demo information:"
.BodyListBegin True, "A" 'Begin a new ordered list
.BodyList "First Name: " & .GetKeyString("FirstName") 'List the FirstName
.BodyList "Last Name: " & .GetKeyString("LastName") 'List the LastName
.BodyList "Age: " & .GetKeyInteger("Age") 'List the Age (as integer)
.BodyList "Default Path: " & .DefaultPath() 'List the default path
.BodyList "Script Filename: " & CGI.GetScriptName() 'List the script name
.BodyList "Browser: " & CGI.EnvHTTPUserAgent 'List the browser type (from environment variable)
.BodyListEnd 'End the list
.BodyHRule True, 2, "20%", htmlAlignCenter
'Show and increment the hit counter, but only for this page
.BodyTextFont "This page has been accessed " & CGI.GetHitCounterInc(App.EXEName) & _
" times!", 1, "#0000FF", "Arial, Helvetica", True
.BodyBreak
.PageEnd 'End and submit the complete page
Else
'Occures, if other than a POST-method was used, or no query string was submitted
.ErrorPage "No POST method used, or no Query String received!"
End If
End With
End Sub