DECUServe VMS Conference 3064.4

     
Next-Reply Prev-Reply    Next-Topic Prev-Topic    ConfDir-Paged-New>Old ConfDir-Paged-Old>New   ConfDir-All-New>Old ConfDir-All-Old>New
       
Directory of conferences This topic directory


Note 3064.4            X10 / X-10 / BSR / Home Automation                4 of 15

EISNER::COVERT "John.Covert@Compaq.com"              57 lines   8-JAN-2000 11:16

            -< Lights CGI at http://www2.covert.org/cgi-bin/lights >-

--------------------------------------------------------------------------------

I see everyone is just speechless about all this.

How about the little CGI script below, then.



Why no status yet?  Because I'm still using the Firecracker program for

the "free" computer interface.  The smarter interface is hooked up, but

unfortunately, the status would only reflect the last remote commands;

I bought one-way switches at $39.95 each (for 10 or more); the two-way

switches are $109.95, and I didn't think accurate status was worth

$1700 or so more.



$! Lights CGI

$ set noon

$! we list all accessed vars right here

$ qstr = www_query_string

$!

$ homeuser = A secret way of figuring out if the user is authorized.

$ if qstr .nes. ""

$ then

$   write sys$output "LOCATION: lights"

$   write sys$output ""

$   if homeuser then submit/nolog/noiden user$:[covert]firecracker/par=('f$eleme

nt(0,"=",qstr)','f$element(1,"=",qstr)')

$   exit

$ endif

$ write sys$output "Content-type: text/html"

$ write sys$output ""

$ write sys$output "<html><head><title>X10 Stuff</title></head><body bgcolor=yel

low><center><h1>X10 Stuff</h1></center>"

$ write sys$output "<form action=""lights"" method=get><table>"

$ open/read x10 user$:[covert]x10assignments.txt

$! throw away two lines

$ read x10 rec

$ read x10 rec

$loop:

$ read/end=endloop x10 rec

$ rec =  f$edit(rec,"compress,trim")

$ if rec .eqs. "" then goto loop

$ xcode = f$element(0," ",rec)

$ descr = f$extract(f$length(xcode)+1,99,rec)

$ if f$extract(0,8,descr) .eqs. "reserved" then goto loop

$ write sys$output "<tr>"

$ if homeuser

$ then

$   write sys$output "<td><input type=submit name=''xcode' value=""ON""></td>"

$   write sys$output "<td><input type=submit name=''xcode' value=""OFF""></td>"

$ else

$   write sys$output "<td><input type=button value=""ON"" onclick=""alert('Not A

uthorized')""></td>"

$   write sys$output "<td><input type=button value=""OFF"" onclick=""alert('Not

Authorized')""></td>"

$ endif

$ write sys$output "<td>''xcode'</td><td>''descr'</td></tr>"

$ goto loop

$endloop:

$ close x10

$ write sys$output "</table></form></body></html>"

$ exit


     
Next-Reply Prev-Reply    Next-Topic Prev-Topic    ConfDir-Paged-New>Old ConfDir-Paged-Old>New   ConfDir-All-New>Old ConfDir-All-Old>New
       
Directory of conferences This topic directory

DECUServe on-line conferencing system - consulting for peanuts

DECnotes Script provided by Roland Kessi, 21 February 1996