I'm writing this in PHP, but, generally speaking, what methods and properties would a user (registration?) class have? I know I can use MDB2 from PEAR for database abstraction, and one feature I can think of is making sure the username is valid.
$user->validateUserName($username, $regex);
Can anybody think of any more?
Thanks.
Edit:
Username validation would be a class of its own right (Validator class or something)?
There shouldn't be a such class at all. Registration is a whole process of receiving data, validating that data and finally, processing validated data if validation succeed. In other words: registration is that part of code which uses some object to solve a given problem.
What will you need?
User
object and saves it.Let's design an interface. How will we use the code we're going to write?
That's of course only an example - it can be designed totally different way.
ValidForm, it's a great class structured to handle your forms both client/server-sided. However, no MySQL is passed through the form.
Well, you should check if
You also need methods to