Home arrow Delphi-Kylix arrow Page 3 - Building a Server Application for an Internet Cafe

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
  1. · Building a Server Application for an Internet Cafe
  2. · User Authentication
  3. · Code Explained
  4. · Code explanation continued

print this article

Building a Server Application for an Internet Cafe - Code Explained
(Page 3 of 4 )

Let's step through the code. The first event handling procedure is fired when the staff member clicks on the logon button. Keep in mind that the staff member is required to enter a username and password to kick start the authentication process. The first part of the procedure checks to see if the staff member has entered her username and password:

if (uname.text = '') OR (upass.Text='') then begin

MessageDlg('Please make sure that you fill in both the username and password fields.', mtInformation,

[mbOk], 0);



If the staff member has not entered their login credentials and presses the login button, an error message is displayed informing the user to enter their details, as the code shows. Otherwise the procedure continues the authentication process by checking to see if the login credentials that the staff member entered exist in the database. The code uses the TADOQuery component, referred to as "q" to connect to the "users" table and then to run a SQL query to check if the credentials entered by the staff member match those in the database:


q.SQL.Text:='SELECT * from users WHERE username=:uname AND password=:upass';



Next the query is "opened" to see if any results have been returned:


The number of records retrieved will be stored in the "Recordcount" property of the query component. If the value of recordcount is greater than zero, then it means that the credentials that the staff member entered were found in the database, in which case the user is authenticated:

if q.RecordCount > 0 then begin

blog comments powered by Disqus

- 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 

Developer Shed Affiliates


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