Implementation of
| |
The PRePTagUSER contains all information about one user. It allows access to all fields of the user's data, stored in the table "docuser". It also provides a method checkUser() which is called if the ACTION tag is set to "login" and returns a new Cookie with the uid of this user, as well as a checkCookie() and a logout() method. The checkUser() method checks also if the company is set to -1. If yes, it means, that the user is a guest. If this is the case, do not update the database with a new cookie but return the cookie which is stored in the database (table "docuser"). If there is no user with this name and password, the method will return the cookie of the "us_guest" and will not update the database. The checkCookie() method returns a boolean and checks if the UINFO tag exists and the value is valid. (SELECT * FROM docuser WHERE cookie = AND uid = ) If the store is null, the cookie is not valid and it returns false. It will return true if the store is not null - what means that the user with this id and cookie exists. The logout() method is called if the ACTION tag is set to "logout". It returns a new cookie with a value of 0. Constructor: default constructor where it sets its name. Methods:
Cookie checkUser() is called when there is an ACTION tag which value is either "login" or "logout" if the value is logout, the logout() method is called. Else: does the user with this password exist? If yes: is the company value = -1?If yes: return new Cookie UINFO (take the cookie of the guest out of the table docuser) and do not update the table! If no: make a new Cookie with a random number, update the table docuser with the new cookie and return the UINFO cookie. If the user does not exist, return a new cookie as if the user logged in as "us_guest" which means, the table docuser will not be updated and the cookie will be taken out of the table.
boolean checkCookie()
Cookie logout() |
|
|