# @(#)add_user.m 1.1 01/04/99 firstbase.com
#
#
# Add_user.m - Copyright by FirstBase Software
#
# This code works with dbmacro, a part of the FirstBase database package.
# For more information, see http://www.firstbase.com
#
# standalone add_user.m
#
# If this user exists, offer back button
# If this user is not in LASTNAME, FIRSTNAME format, do not accept
# Else accept -- and serve accept page
main()
{
load(path_dir + "../macro/library.m")
comments()
print(html_open("Hardware Management System: Add a User"))
wheader("Add a User")
init_user()
if (length(Name) > field_size("UsrName", ub))
Name = substr(Name, 1, field_size("UsrName", ub))
Name = upper(Name)
st = AOK
if (getxrec(Name, ub) == AOK){
printf(" ``%s'' is already in the user database.\n", Name);
print(html_br())
st = ERROR
}
else{
#
# error check Name now
#
if (index(Name, ",") <= 0){
printf("``%s'' needs to be in ``LastName, FirstName'' format.\n",
Name)
print(html_br())
st = ERROR
}
if (st == AOK){
n = nfields(ubase)
for (i = 1; i <= 17; i++)
ubase[i] = ""
ubase[UsrName] = Name
ubase[CreateIP] = IP
ubase[CreateTime] = IP_TIME
st = addrec(ub)
}
}
print(html_p_open())
if (st == AOK)
printf("Successefully added %s\n.", Name)
else
printf("Name ``%s'' NOT added.\n.", Name)
wfooter("/admin/adminmenu.html")
print(html_close())
}
© Copyright 1996-2000 FirstBase Software, Inc. |