Home arrow Delphi-Kylix arrow Page 4 - Building a Server Application for an Internet Cafe
DELPHI-KYLIX

Building a Server Application for an Internet Cafe


If you're building an Internet access control application, such as you might find in an Internet cafe, you can't do it without some way to keep track of the staff members who log users into the computers. This article, the second part of a six-part series that covers the entire application, will deal with user authentication, including the setting up of a database to track the important information.

Author Info:
By: David Web
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
August 25, 2008
TABLE OF CONTENTS:
  1. · Building a Server Application for an Internet Cafe
  2. · User Authentication
  3. · Code Explained
  4. · Code explanation continued

print this article
SEARCH DEVARTICLES

Building a Server Application for an Internet Cafe - Code explanation continued
(Page 4 of 4 )

Now we need to update form1 and its variables. Form1 is the main server interface where we will allocate sessions for clients. The first update we make is to display the name of the just-logged-in staff member in the form's caption:

form1.caption:='iCafeStation 1.0 - Current user: '+q.fieldbyname('username').Text;


Then we set the access level of the staff member, which will either be admin or normal and we also set the userid:


form1.level:=q.fieldbyname('Alevel').Text;

form1.uid:=q.fieldbyname('iud').AsInteger;


Now, staff with an access level of "normal" will not have access to certain parts of the application, such as the application settings and the ability to add new staff members. These privileges are reserved for staff members with "admin" status. This is where those restrictions are set:

if form1.level = 'Normal' then begin

form1.Settings1.Enabled:=false;

form1.newOp.Enabled:=false;

end;

Then the logon screen is made invisible. We cannot close down the logon screen because if we do, then the entire server application will be terminated and that's not what we want to do at this stage:

form3.Visible:=false;


We then show the main server screen available, by showing form1:


form1.show;


and then clear the entries in the logon screen:

uname.Clear;

upass.Clear;

isLogon:=true;

end

The next part of the authentication process deals with what happens when the staff member enters incorrect logon credentials. First we check to see if the recordcount is less than one:

else

begin

if q.recordcount < 1 then begin

If the recordcount is indeed less than one, then it means that the staff member details could not be found in the database, so the user is informed of this:

MessageDlg('Your Username or password is not found, please try again.', mtInformation,

[mbOk], 0);


Then the username and password fields are cleared:


uname.Clear;

upass.Clear;

end;

end;

end;

Conclusion

That's it for the authentication application. I would like to emphasis that it is not written with security in mind, but rather for staff management. In the next article we will discuss the main server interface and also the user management module.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials