// Try to find the login name and password
cursor = database.cursor("select * from cl_person where p_login = '" +
request.login + "' and p_password = '" + request.password +
"';");
if (cursor.next())
{
// Remember who the user is
client.uid = cursor.p_id;
client.admin = ((cursor.p_type == 'A') ? "true" : "false");
// Redirect to appropriate interface based on user type
if (cursor.p_type == 'A')
newpage = "admin.htm";
else
newpage = "user.htm";
}
else
// No match - incorrect login
newpage = "login-bad.htm";
cursor.close();
redirect(newpage);