|
Some months ago i was thinking of adding a chat window to my web site. Time has passed by Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript is Numeric functions: nownow probably disfunct, but may serve as a Integer numbers: Base 256base for own work.
chat.cgi chat.history chat.sessions
/cgi-bin/chat.cgi
#!/home/smile77/bin/vipsi
// chat Example Scripts: CGI Scripts Example Scripts: Scriptsscript as used on my homepage
// ----------------------------------
// very basic Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and buggy
// please adjust paths!
Instructions: var How does VScript::Value() work?: Var*&var argc = Numeric functions: countcount globals-1
Instructions: var How does VScript::Value() work?: Var*&var Title = "Chat Operators: Make Identifier "@"at little-bat"
Instructions: var How does VScript::Value() work?: Var*&var H1_Login = "Welcome to chat Operators: Make Identifier "@"at little-bat!"
Instructions: var How does VScript::Value() work?: Var*&var H1_Input = "Chat Operators: Make Identifier "@"at little-bat!"
Instructions: putput "content-type: Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=utf-8\n\n"
/* Kio's chat Example Scripts: CGI Scripts Example Scripts: Scriptsscript
Flow control: if … then Flow control: try … thenthe chat consists of a frameset with an input frame Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and an output frame.
Flow control: if … then Flow control: try … thenthe frameset is written Flow control: if … then Flow control: if … thenif the Example Scripts: CGI Scripts Example Scripts: Scriptsscript is called with no Vipsi command syntax: Arguments Glossary: Argumentsarguments
Flow control: if … then Flow control: try … thenthe output frame is written Flow control: if … thenif Action == "Output"
Flow control: if … then Flow control: try … thenthe input frame is written for Action == "Input"
*/
Flow control: if … thenif !Numeric functions: existsexists Action Instructions: var How does VScript::Value() work?: Var*&var Action = "Frameset" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !Numeric functions: existsexists SessionID Instructions: var How does VScript::Value() work?: Var*&var SessionID = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.UNIQUE_ID Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !Numeric functions: existsexists Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName Instructions: var How does VScript::Value() work?: Var*&var Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName = "" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !Numeric functions: existsexists Password Instructions: var How does VScript::Value() work?: Var*&var Password = "" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !Numeric functions: existsexists TextInput Instructions: var How does VScript::Value() work?: Var*&var TextInput = "" Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var Sessions = {} // from Text functions: file Instructions: filefile
Instructions: var How does VScript::Value() work?: Var*&var Interactive Shell: HistoryHistory = {} // from Text functions: file Instructions: filefile
Instructions: var How does VScript::Value() work?: Var*&var Http = {}
Instructions: var How does VScript::Value() work?: Var*&var Text functions: file Instructions: fileFile = {}
Instructions: var How does VScript::Value() work?: Var*&var Style = {}
Instructions: var How does VScript::Value() work?: Var*&var Img = {}
Instructions: var How does VScript::Value() work?: Var*&var ScriptFilename = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.SCRIPT_FILENAME // "/home...cgi-bin/Listings: chat.cgichat.cgi"
Instructions: var How does VScript::Value() work?: Var*&var Example Scripts: CGI Scripts Example Scripts: ScriptsScript = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.SCRIPT_NAME // "/bin-cgi/Listings: chat.cgichat.cgi"
Instructions: var How does VScript::Value() work?: Var*&var Text functions: file Instructions: fileFile.Root = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.DOCUMENT_ROOT # "/" // "/home/pub/www/"
Instructions: var How does VScript::Value() work?: Var*&var Text functions: file Instructions: fileFile.CgiDir = ScriptFilename[to Numeric functions: rfindrfind(ScriptFilename,"/")]
Instructions: var How does VScript::Value() work?: Var*&var Text functions: file Instructions: fileFile.Interactive Shell: HistoryHistory = Text functions: file Instructions: fileFile.CgiDir # "Listings: chat.historychat.history"
Instructions: var How does VScript::Value() work?: Var*&var Text functions: file Instructions: fileFile.Sessions = Text functions: file Instructions: fileFile.CgiDir # "Listings: chat.sessionschat.sessions"
Instructions: var How does VScript::Value() work?: Var*&var Http.Host = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.HTTP_HOST // "10.0.0.4"
Instructions: var How does VScript::Value() work?: Var*&var Http.Root = "/"
Flow control: if … thenif Http.Host=="10.0.0.4" || Text functions: lowerstrlowerstr(Http.Host[to 4])=="eden"
Text functions: file Instructions: fileFile.Root #= "little-bat.de/"
Http.Root #= "little-bat.de/"
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var Http.Images = Http.Root # "b/"
Instructions: var How does VScript::Value() work?: Var*&var Http.Hdgr = Http.Images # "hdgr.jpg"
Instructions: var How does VScript::Value() work?: Var*&var Http.Bat128 = Http.Images # "bat_sw_128_frei.png"
Instructions: var How does VScript::Value() work?: Var*&var Http.Space = Http.Images # "_.gif"
Instructions: var How does VScript::Value() work?: Var*&var Style.NoGap = " style='margin:0px;padding:0px;' "
Instructions: var How does VScript::Value() work?: Var*&var Style.Body = " style='margin:0px;padding:8px; \
background-color:#cccccc; \
background-image:url(" #Http.Hdgr# ")' "
Instructions: var How does VScript::Value() work?: Var*&var Style.Self = "style='font-weight:bold;'"
Instructions: var How does VScript::Value() work?: Var*&var Style.Kio = "style='color:#000099;'"
Instructions: var How does VScript::Value() work?: Var*&var Style.User = "style=''"
Instructions: var How does VScript::Value() work?: Var*&var Style.Anon = "style='color:#666666;'"
Instructions: var How does VScript::Value() work?: Var*&var Img.Bat128 = "<img width=128 height=128 src='" #Http.Bat128# "'>"
Instructions: procproc Img.Space(w,h)
{ Flow control: returnreturn "<img width='" #w# "' height='" #h# "' src='"#Http.Space#"'>" }
/* ----------------------------------------------------------------------
in: Action == Frameset
=> send frameset
*/
Flow control: if … thenif Action=="Frameset"
Instructions: putput«
<!doctype html public "-//w3c//dtd html 4.01 frameset//en"
<html>
<head>
<title>» #Title# «</title>
<meta http-equiv='content-type' content='Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=utf-8'>
<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='author' content='kio@little-bat.de'>
<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='robots' content='noindex'>
</head>
<frameset rows='256,*'>
<frame src='» ,Example Scripts: CGI Scripts Example Scripts: ScriptsScript, «?Action=Login' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='chat_input' scrolling=no>
<frame src='» ,Example Scripts: CGI Scripts Example Scripts: ScriptsScript, «?Action=Empty' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='chat_output'>
</frameset>
<body><h1>Frames required!!</h1></body></html>
»
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
/* -------------------------------------------------------------------
Action != Frameset
=> send standard frame header
*/
Instructions: putput «\
<!doctype html public "-//w3c//dtd html 4.01 transitional//en"
<html>
<head>
<title>» #Title# «</title>
<meta http-equiv='content-type' content='Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=utf-8'>
<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='author' content='kio@little-bat.de'>
»
Flow control: if … thenif Action=="Output"
Instructions: putput «<meta http-equiv="refresh" content=\"20; URL=»
# Example Scripts: CGI Scripts Example Scripts: ScriptsScript
# "?Action=Output&SessionID="
# SessionID
# «">\n»
Flow control: if … then Flow control: try … thenthen
Instructions: putput «<style type='Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/css'><!--
table,tr,td,p,h1,h2,form,input {padding:0px;margin:0px;}
--></style>
</head>
»
/* --------------------------------------------------------------------
Action == ShowSource
show my own source:
*/
Flow control: if … thenif Action == "ShowSource"
Instructions: var How does VScript::Value() work?: Var*&var mysource = Text functions: file Instructions: filefile(ScriptFilename)
Text functions: convert Instructions: convertconvert mysource from utf8
Text functions: convert Instructions: convertconvert mysource to html
Instructions: putput "<body", Style.Body, ">\n"
Instructions: putput "<pre>",Constants: nlnl, mysource, Constants: nlnl,"</pre></body></html>",Constants: nlnl
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
/* ---- Utilities -----------------------------------------------------
*/
Instructions: procproc Styled ( style, block )
{
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: findfind(block,">")
Flow control: returnreturn block[to i-1] # " " # style # block[i to]
}
Instructions: procproc Block ( tag, content )
{
Instructions: var How does VScript::Value() work?: Var*&var r1 = "<" # tag # "\n>"
Instructions: var How does VScript::Value() work?: Var*&var r3 = "</" # tag # "\n>"
Flow control: if … thenif Numeric functions: islistislist content
Instructions: var How does VScript::Value() work?: Var*&var r2 = ""
Instructions: var How does VScript::Value() work?: Var*&var i=0 Flow control: do … loopdo Flow control: whilewhile ++i<=Numeric functions: countcount content r2 #= content[i] Flow control: do … looploop
Flow control: returnreturn r1 # r2 # r3
Flow control: if … then Flow control: try … thenelse
Flow control: returnreturn r1 # content # r3
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc H1 ( Data Types: Text Item selector "[]": Text Glossary: text, text_valtext ) { Flow control: returnreturn Block("h1",Data Types: Text Item selector "[]": Text Glossary: text, text_valtext) }
Instructions: procproc H2 ( Data Types: Text Item selector "[]": Text Glossary: text, text_valtext ) { Flow control: returnreturn Block("h2",Data Types: Text Item selector "[]": Text Glossary: text, text_valtext) }
Instructions: procproc P ( Data Types: Text Item selector "[]": Text Glossary: text, text_valtext ) { Flow control: returnreturn Block("p", Data Types: Text Item selector "[]": Text Glossary: text, text_valtext) }
Instructions: procproc Table ( rows )
{
Flow control: returnreturn Styled(
"cellpadding=0 cellspacing=0 border=0",
Block("table", rows)
)
}
Instructions: procproc TR ( cells )
{
Flow control: returnreturn Styled( "valign=top", Block("tr",cells) )
}
Instructions: procproc TD ( content )
{
Flow control: if … thenif content=="" content=" " Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn Block( "td", content )
}
Instructions: procproc Input ( )
{
Flow control: returnreturn "<input type='Data Types: Text Item selector "[]": Text Glossary: text, text_valtext'" # Style.NoGap # "\n>"
}
Instructions: procproc Button ( url, Data Types: Text Item selector "[]": Text Glossary: text, text_valtext )
{
Flow control: returnreturn
"<input type='button' Glossary: Valuevalue='" #text# "' " #
Style.NoGap #
« onClick="location.href='» #url# «'">»
}
Instructions: procproc Form ( content )
{
Flow control: returnreturn Styled(
«action="» #Script# «" method="post"»,
Block( "form", content )
)
}
Instructions: procproc JS ( jscript )
{
Flow control: returnreturn
"<Example Scripts: CGI Scripts Example Scripts: Scriptsscript type=\"Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/javascript\">" # jscript #
"</Example Scripts: CGI Scripts Example Scripts: Scriptsscript>\n"
}
Instructions: procproc WriteSessions()
{
/* ***TODO*** blocking */
Text functions: file Instructions: filefile Text functions: file Instructions: fileFile.Sessions = Data Types: Text Text functions: stringstring Sessions
}
Instructions: procproc ReadSessions()
{
/* ***TODO*** blocking */
Flow control: if … thenif Sessions=={} Sessions = Functions with varying return types: eval Instructions: evaleval Text functions: file Instructions: filefile Text functions: file Instructions: fileFile.Sessions Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc WriteHistory()
{
/* ***TODO*** blocking */
Text functions: file Instructions: filefile Text functions: file Instructions: fileFile.Interactive Shell: HistoryHistory = Data Types: Text Text functions: stringstring Interactive Shell: HistoryHistory
}
Instructions: procproc ReadHistory()
{
/* ***TODO*** blocking */
Flow control: if … thenif Interactive Shell: HistoryHistory=={} Interactive Shell: HistoryHistory = Functions with varying return types: eval Instructions: evaleval Text functions: file Instructions: filefile Text functions: file Instructions: fileFile.Interactive Shell: HistoryHistory Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc FindName()
{
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: countcount Sessions +1
Flow control: do … loopdo
Flow control: whilewhile --i
Flow control: untiluntil Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName==Sessions[i,1]
Flow control: do … looploop
Flow control: returnreturn i
}
/* ---- Check Login --------------------------------------------------
in: Action == "CheckLogin"
Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername
Password = password
*/
Flow control: if … thenif Action == "CheckLogin"
ReadSessions()
ReadHistory()
Instructions: procproc PW_OK()
{
Flow control: if … thenif Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName[1]=="(" Flow control: returnreturn 0 Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: countcount Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName<3 Flow control: returnreturn 0 Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var i = FindName()
Flow control: if … thenif i==0 Flow control: returnreturn 0 Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Password!=Sessions[i,2] Flow control: returnreturn 0 Flow control: if … then Flow control: try … thenthen
Sessions[i,3] = SessionID
Flow control: returnreturn 1
}
Flow control: if … thenif Password=="" && Numeric functions: countcount Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName >= 3
Action = "Input"
Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName = "(" # Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName # ")"
Sessions ##= {{ Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, "", SessionID, Numeric functions: nownow }}
Interactive Shell: HistoryHistory ##= {{ Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, SessionID, "+++ logged in +++" }}
Flow control: if … then Flow control: try … thenelse Flow control: if … thenif !PW_OK()
Action = "RetryLogin"
Interactive Shell: HistoryHistory ##= {{ Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, SessionID, "+++ failed to Numeric functions: log Numeric functions: loge Instructions: loglog in +++" }}
Flow control: if … then Flow control: try … thenelse
Action = "Input"
Interactive Shell: HistoryHistory ##= {{ Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, SessionID, "+++ logged in +++" }}
Sessions[FindName(),4] = Numeric functions: nownow
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Action!="RetryLogin" WriteSessions() Flow control: if … then Flow control: try … thenthen
WriteHistory()
Flow control: if … then Flow control: try … thenthen
/* ---- Login ---------------------------------------------------------
in: Action == "Login" / "RetryLogin"
=> present Flow control: if … then Flow control: try … thenthe login screen
*/
Flow control: if … thenif Action=="Login" || Action=="RetryLogin"
Instructions: procproc Login()
{
Instructions: var How does VScript::Value() work?: Var*&var text1 =
H1(H1_Login) #
"<p>List functions: thisThis chat system is for help Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and discussions related to \
software Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and projects on List functions: thisthis site."
"<p>Please Numeric functions: log Numeric functions: loge Instructions: loglog in." #
"<br> "
Instructions: var How does VScript::Value() work?: Var*&var t1 =
TD( "Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName" ) #
TD( "<input type='Data Types: Text Item selector "[]": Text Glossary: text, text_valtext' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName' \
size=20 style='width:100%'>" )
Instructions: var How does VScript::Value() work?: Var*&var t2 =
TD( "Password" ) #
TD( "<input type='password' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='Password' \
size=20 style='width:100%'>" )
Instructions: var How does VScript::Value() work?: Var*&var t3 =
TD("<input type='hidden' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='Action' Glossary: Valuevalue='CheckLogin'>") #
Styled( "width='70%' align=right", TD("<input type='submit'
Glossary: Valuevalue='Enter' style='width:50%'>") )
Instructions: var How does VScript::Value() work?: Var*&var t = TR(t1) ## TR(t2) ## TR(t3)
Instructions: var How does VScript::Value() work?: Var*&var text2 = ""
Flow control: if … thenif Action=="RetryLogin"
text2 = "<p style='color:#cc0000'>Your login failed!"
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var text3 =
"<p>Flow control: if … thenIf you are Instructions: newnew, enter your Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and leave Flow control: if … then Flow control: try … thenthe password blank." #
"<br>Send e-mail to Kio to register a user Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and password."
Flow control: returnreturn text1 # Styled("Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='login_form'",Form(Table(t))) #
text2 # text3
}
Instructions: var How does VScript::Value() work?: Var*&var td={}
td ##= Styled( "width=128 height=128", TD(Img.Bat128) )
td ##= Styled( "width=16", TD(Space(16,2)) )
td ##= Styled( "align=center", TD(Login()) )
Instructions: putput "<body", Style.Body, ">\n"
Instructions: putput Styled( "width='100%'", Table(TR(td)) )
Instructions: putput JS
( // on load: focus for Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername input
"document.login_form.Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName.focus();"
)
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
/* ---- Input --------------------------------------------------------------
in: Action == "Input"
SessionID = Session ID
List functions: thisthis runs in Flow control: if … then Flow control: try … thenthe upper frame is never reloaded again
submitting Flow control: if … then Flow control: try … thenthe form reloads Flow control: if … then Flow control: try … thenthe lower frame with Flow control: if … then Flow control: try … thenthe Instructions: newnew Interactive Shell: Historyhistory
*/
Flow control: if … thenif Action == "Input"
ReadSessions()
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile ++i<=Numeric functions: countcount Sessions
Flow control: untiluntil SessionID==Sessions[i,3]
Flow control: do … looploop
Flow control: if … thenif i>Numeric functions: countcount Sessions Instructions: putput "<p>internal error #306#",Constants: nlnl Flow control: end Shell Immediate Commands: exit, quit, endend vipsi - the friendly one.: The namethen
Name = Sessions[i,1]
Password = Sessions[i,2]
Instructions: procproc Enter()
{
Instructions: var How does VScript::Value() work?: Var*&var Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = H1(H1_Input) # P("please be patient!")
Instructions: var How does VScript::Value() work?: Var*&var f1 = "<textarea onKeyUp='CheckForSend()' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='TextInput' \
cols=50 rows=4></textarea>"
Instructions: var How does VScript::Value() work?: Var*&var f2 = "<input type='submit' Glossary: Valuevalue='Send'>"
Instructions: var How does VScript::Value() work?: Var*&var f3 = "<input type='hidden' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='Action' Glossary: Valuevalue='Output'>"
Instructions: var How does VScript::Value() work?: Var*&var f4 = "<input type='hidden' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='SessionID' Glossary: Valuevalue='"#SessionID#"'>"
Instructions: var How does VScript::Value() work?: Var*&var f5 = "<input type='hidden' Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName' Glossary: Valuevalue='"#Name#"'>"
Instructions: var How does VScript::Value() work?: Var*&var f6 = Styled( "href='"#Script#
"?Action=ShowSource' target='chat_output'",
Block("a","show source") )
Instructions: var How does VScript::Value() work?: Var*&var form = Styled( "Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername='input_form' target='chat_output'",
Form(f1#"<p>"#f6#f3#f4#f5#" "#f2) )
Flow control: returnreturn Data Types: Text Item selector "[]": Text Glossary: text, text_valtext # form
}
Instructions: var How does VScript::Value() work?: Var*&var td={}
td ##= Styled( "width=128 height=128", TD(Img.Bat128) )
td ##= Styled( "width=16", TD(Space(16,2)) )
td ##= Styled( "align=center", TD(Enter()) )
Instructions: putput "<body onUnload=\"Logout();\" ", Style.Body, ">\n"
Instructions: putput JS
( // onKeyUp event: works only for few browsers
"Vipsi command syntax: Functions Functions Glossary: Functionfunction CheckForSend(){Instructions: var How does VScript::Value() work?: Var*&var d=document.input_form, \
t=d.TextInput, v=t.Glossary: Valuevalue;" #
"Flow control: if … thenif(v[v.length-1]<\" \") { d.submit(); t.Glossary: Valuevalue=\"\"; \
t.focus(); } }" #
// onUnload event: seems to work when Instructions: newnew url loaded
// but Operators: Bitwise Not "~" Operators: Boolean Negation "!"not when window closed
"Vipsi command syntax: Functions Functions Glossary: Functionfunction Logout(){Instructions: var How does VScript::Value() work?: Var*&var d=document.input_form, t=d.TextInput; \
t.Glossary: Valuevalue=\"--- logged out ---\";d.submit();}"
)
Instructions: putput Styled( "width='100%'", Table(TR(td)) )
Instructions: putput JS
( // on load: focus for textarea
"document.input_form.TextInput.focus();" #
"parent.chat_output.location.href=\""#Script#
"?Action=Output&SessionID="#SessionID#"\";"
)
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: countcount Sessions +1
Flow control: do … loopdo
Flow control: whilewhile --i
Flow control: untiluntil Sessions[i,3]!="" && Sessions[i,3]!=SessionID
Flow control: do … looploop
Flow control: if … thenif !i && Text functions: lowerstrlowerstr(Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName)!="kio"
Instructions: putput JS("alert(\"You are alone. Kio is Operators: Bitwise Not "~" Operators: Boolean Negation "!"not online.\n\
You may leave Flow control: if … then Flow control: try … thenthe chat window hanging around Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Instructions: waitwait.\")")
Flow control: if … then Flow control: try … thenthen
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
/* ---- Output ----------------------------------------------------------
in: Action == "Output"
TextInput = Instructions: newnew Data Types: Text Item selector "[]": Text Glossary: text, text_valtext Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or empty
SessionID = session ID
*/
Flow control: if … thenif Action == "Output"
ReadHistory()
ReadSessions()
Instructions: var How does VScript::Value() work?: Var*&var i=Numeric functions: countcount TextInput
Flow control: do … loopdo
Flow control: whilewhile i>=1
Flow control: whilewhile TextInput[i]<=" "
Instructions: var How does VScript::Value() work?: Var*&var z = TextInput[to --i]
TextInput = z
Flow control: do … looploop
Instructions: putput "<body", Style.Body, ">\n"
Flow control: do … loopdo Flow control: whilewhile Numeric functions: countcount Interactive Shell: HistoryHistory > 20 Instructions: deldel Interactive Shell: HistoryHistory[1] Flow control: do … looploop
Flow control: if … thenif TextInput!=""
Interactive Shell: HistoryHistory ##= {{ Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, SessionID, TextInput }}
WriteHistory()
Instructions: putput JS("Instructions: var How does VScript::Value() work?: Var*&var t=parent.chat_input.document.input_form.TextInput; \
t.Glossary: Valuevalue=\"\";t.focus();")
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: countcount Sessions +1
Flow control: do … loopdo
Flow control: whilewhile --i
Flow control: if … thenif Sessions[i,3]==SessionID Sessions[i,4] = Numeric functions: nownow Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Sessions[i,3]!="" && Numeric functions: nownow - Sessions[i,4] > 60
Interactive Shell: HistoryHistory ##= {{ Sessions[i,1], Sessions[i,3], "--- vanished ---" }}
WriteHistory()
Sessions[i,3] = ""
Flow control: if … thenif Sessions[i,1,1]=="(" Instructions: deldel Sessions[i] Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
WriteSessions()
Instructions: var How does VScript::Value() work?: Var*&var i=Numeric functions: countcount Interactive Shell: HistoryHistory
Flow control: do … loopdo
Flow control: whilewhile i
Instructions: var How does VScript::Value() work?: Var*&var style = Style.User
Flow control: if … thenif Interactive Shell: HistoryHistory[i,1,1]=="(" style = Style.Anon Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: lowerstrlowerstr(Interactive Shell: HistoryHistory[i,1])=="kio" style = Style.Kio Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Interactive Shell: HistoryHistory[i,2]==SessionID style=Style.Self Flow control: if … then Flow control: try … thenthen
Text functions: convert Instructions: convertconvert Interactive Shell: HistoryHistory[i,1] to html
Text functions: convert Instructions: convertconvert Interactive Shell: HistoryHistory[i,3] to html
Instructions: putput Styled( style, "<p>" # Interactive Shell: HistoryHistory[i,1] # ": " # Interactive Shell: HistoryHistory[i,3] # Constants: nlnl )
i--
Flow control: do … looploop
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
/* -----------------------------------------------------------------------
Action == Empty Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or bogus
=> empty frame
*/
Instructions: putput "<body", Style.Body, ">\n"
Flow control: if … thenif Action!="Empty"
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile ++i<=argc
Instructions: putput "<p>", Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername List functions: globals Shell Immediate Commands: globalsglobals[i], " = ", List functions: globals Shell Immediate Commands: globalsglobals[i]
Flow control: do … looploop
Flow control: if … then Flow control: try … thenthen
Flow control: end Shell Immediate Commands: exit, quit, endend
/* List functions: thisthis Text functions: file Instructions: filefile is a dump of Instructions: var How does VScript::Value() work?: Var*&var Sessions
*/
{ { "Username", "Password" }, { "User2","Password2" } }
/* List functions: thisthis Text functions: file Instructions: filefile is a dump of Instructions: var How does VScript::Value() work?: Var*&var Interactive Shell: HistoryHistory
*/
{ { "User", "SesisonID", "example message" } }
| |