Can you help me point out method names that you see will prevent reuse?
In your class the
auth,
checkempty and
adduser methods should ideally not echo HTML, but rather return a boolean or an error code.
The
displogin method also echoes HTML, but it can hardly be considered a logic method. It's more a HTML-specific display method. I would actually argue that it doesn't belong to that class, but rather in the HTML page itself, but that's a different matter.
As a side-note. You should try to avoid abbreviating your method names, like "auth". Even if it seems obvious to you what it stands for at the moment, it may not seem that obvious in the future, if you, or whoever receives your code, ever need to review it.
It's best to adopt a good naming convention and stick to it throughout the project. The PHP "standard" is to use all-lower case names, using _ to separate words.
('authenticate', 'check_empty', 'add_user').
Personally, I like the C# naming conventions.
('Authenticate', 'CheckEmpty', 'AddUser'). It allows me to more clearly distinguish between public and private methods.
('PublicMethod', 'privateMethod')
I see that I should change all login prompts may be to use XML (is that what you said?)
Not really, no. The XML example was just to demonstrate how the code could be reused for a different purpose other than to print HTML. You don't need to worry about this until you need to print something other than HTML.
Another thing is, I have not learned Ajax.
All I have is the basics of both JavaScript and XML, but not anything Ajaxed.
Anyway, is ajax "long curve" to learn? I would be happy to learn and implement that.
AJAX is just a method used by client-side code (JavaScript, usually) to fetch data from the server without having to do a full refresh. The AJAX code itself is fairly simple, but to use it you need to write the client-side (JavaScript) code that uses the data it retrieves.
Check out the
W3Schools AJAX tutorial. It explains the basics of AJAX very quickly.