| Description | The http_check_account function checks if an user account for provided credentials exist in the user database. It is called from the TCPnet Web server to check if the user with provided credentials is allowed to access the Web pages or not. The argument user points to a buffer containing the user name which was typed in from the browser. The argument passw specifies the password. Both arguments are 0-terminated strings. The http_check_account function is in the HTTP_MultiUser.c module. The prototype is defined in net_config.h. note - This function is optional. For single user HTTP authentication or when the HTTP authentication is disabled from the configuration, this function is not required.
|
| Example |
/* Local variables. */
static const char *users[] = {
"Dave",
"Michael",
"Guest"};
static const char *passwords[] = {
"test1",
"test2",
""};
U8 http_check_account (U8 *user, U8 *passw) {
/* This function checks externally provided user account. */
int i;
for (i = 0; i < 3; i++) {
if ((strcmp ((char *)user, users[i]) == 0) &&
(strcmp ((char *)passw, passwords[i]) == 0)) {
/* Return user index + 1. */
return (i+1);
}
}
/* User account does not exist. */
return (0);
}
|