suve

awful: function: post-prepare

Declaration

NIL :post-prepare

Summary

:!: Not available in CGI mode.
In CGI mode, this function is called automatically upon interpreter start. Performing a user call does nothing.

Retrieves HTTP POST data - first, checks content length by accessing the CONTENT_LENGTH environment variable, and then reads the appropriate amount of bytes from stdin. After data has been read, breaks it into name-value pairs to be used by other :post- functions.

Note that, since POST data is taken from stdin, calling this function in a script which is not invoked by a HTTP server may make the interpreter wait for data to appear on stdin. (Although this shouldn't happen unless you purposely set up the CONTENT_LENGTH variable.)

Example

# POST example - a page login.
# Remember not to store passwords in plaintext.
:post-prepare
:set &U :eq s'admin' :post-val s'username'
:set &P :eq s'admin1' :post-val s'password'
!if :and $U $P
    :page-admin-login
    !fi

wikistrona zmodyfikowana 2014/0601/2317