Knickers: Change your underwear!
Users in Knickers

Knickers has a built-in login managment mechanism called LoginManager. If you'd like to use it, you will need some form of users table and a corresponding Thing class. A sample users table structure looks like this for PostgreSQL, but you can use any table that has, at a minimum, an id field, a login field (usually EMAIL or USERNAME), and a password field.

create table users (
user_id serial,
user_class int,
user_perm int,
user_status int,
email varchar,
password varchar,
first_name varchar,
last_name varchar,
locale varchar,
updated timestamp,
last_login timestamp,
prev_login timestamp,
created timestamp,
primary key(user_id),
unique(email)
);

Or if you prefer MySQL:

create table users (
user_id int auto_increment,
user_class int,
user_perm int,
user_status int,
email varchar(64),
password varchar(32),
first_name varchar(32),
last_name varchar(32),
locale varchar(8),
updated timestamp,
last_login timestamp,
prev_login timestamp,
created timestamp,
primary key(user_id),
unique(email)
);

You will also need to define the LOGINMANAGER constants in your knickers_app.cfg.php file.

Now it's easy to make your application able to accept logins. Add this to your template:

{LOGINMANAGER.VIEWER_LOGGED_IN.BOOL?|VANISH|}
	<form method='POST' action='{PHP_SELF}' name='login'>
		<p>
			{LOGINMANAGER.LOGINFIELD.ERROR} email: {LOGINMANAGER.LOGINFIELD.INPUT}
			{LOGINMANAGER.PASSWORD.ERROR} password: {LOGINMANAGER.PASSWORD.INPUT}
			<input type='submit' value='login'>
		</p>
	</form>
{/LOGINMANAGER.VIEWER_LOGGED_IN.BOOL?|VANISH|}
{LOGINMANAGER.VIEWER_LOGGED_IN.BOOL?:|VANISH|}
	<p>
		Welcome <strong>{VIEWER.FIRST_NAME} {VIEWER.LAST_NAME}</strong> 
		<a href='/page/Logout/page'>Logout</a>
	</p>
{/LOGINMANAGER.VIEWER_LOGGED_IN.BOOL?:|VANISH|}

Assuming you've created some entries in your user table, those users should now be able to "log in" to your site.