SN_LOGIN

NAME

sn_login - use to handle login for Extenso

SYNOPSIS

sn_login ([user_table:string, login_table:string, sleeptime:integer, timeout:integer, expire:integer] username:string,password:string)

sn_login ([user_table:string, login_table:string, cookie:string, sleeptime:integer, timeout:integer, expire:integer])

sn_logout ([login_table:string, cookie:string])

DESCRIPTION

In the first form this function is used to verify the login of a user. If the login is ok, table sn_users_login will be update with the cookie of the user use to verify the connection of the user using a cookie.

In the second form, this function is used to verify the connection of a user.

logout is used to logout the current user or the user specify by the cookie.

PARAMATERS

user_table
table for the list of user. default is sn_users. table must have the following rows: username, password, sn_hash_password, nb_login
login_table
Specify login table which must have ip, cookie (unique key) and uid_user
username
Specify username
password
Password in clear
cookie
Cookie of the user
sleeptime
On a bad login, sleep for this amount of seconds. Default is 5.
expire
Delete entry in sn_users_login older then expire days. Default is 90.
timeout
Timeout in seconds when login is not valid.

RETURNS

sn_login
For the login return the user information in an hash array. Add entry cookie with the value of the cookie. Return null if the information is not ok.
sn_logout
Return the result of the update in the database

EXAMPLES


{{ 
	%include "/extenso/functions/sn_login.snc"; 
}}

\{{ 
sn_session_set("captcha",c[1], exp:"+300s");
sn_session_get("captcha");
sn_session_del("key1","key2");
}}

SEE ALSO

AUTHOR

Written by Pierre Laplante

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com