Re: CGI?
Re: CGI?
- Subject: Re: CGI?
- From: Yosemite <email@hidden>
- Date: Thu, 12 Apr 2001 11:50:42 -0800
-- this is a rough example, you will need to make changes to path locations,
ip address, etc.
(*
to call the cgi from html, save the following as an html file
<html>
<a href="
http://10.5.10.128/cgi-bin/PageCounter.cgi">Click</a>
</html>
*)
-- set up the HTML header
property crlf : (ASCII character 13) & (ASCII character 10)
property http_header : "HTTP/1.0 200 OK" & crlf & "Server: STAMP" & ,
crlf & "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf &
crlf
-- set up time to quit the cgi
property idletime : 180
property datestamp : 0
set datestamp to current date
-- check to see if we can quit
on idle
if (current date) > (datestamp + idletime) then
quit
end if
return 5
end idle
-- we're outta here!
on quit
continue quit
end quit
on handle CGI request path_args ,
searching for http_search_args with posted data post_args using access
method method ,
from address client_address from user username using password |password|
with user info ,
from_user from server server_name via port server_port executing by
script_name ,
of content type content_type referred by referrer from browser
user_agent
set icount to 0
if client_address is not "10.5.10.128" then
tell application "Finder"
set thisDisk to (name of startup disk as string)
set fRef to open for access file "HD 0:stamp:icount" with write
permission
set icount to read fRef before return
write icount + 1 to fRef starting at 1
--close access fRef
end tell
end if
set return_page to http_header & "You are visitor " & icount & "<BR>" &
,
"<BR><P><a href=\"
http://10.5.10.128/\">Back to STAMP</a>"
return return_page
end handle CGI request
-- hcir
mailto:email@hidden
>
>
Now, what do I have to do in order to get the number to display in the
>
web page? I'm using Claris Home Page to write the HTML and am using
>
Personal Web Sharing to publish the page.
References: | |
| >CGI? (From: Michelle Steiner <email@hidden>) |