Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Building a Server Application for an Inter...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Building a Server Application for an Internet Cafe
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-08-25

    Table of Contents:
  • Building a Server Application for an Internet Cafe
  • User Authentication
  • Code Explained
  • Code explanation continued

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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);

    exit;

    end;


    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.close;

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

    q.Parameters.ParamByName('uname').Value:=uname.Text;

    q.Parameters.ParamByName('upass').Value:=upass.Text;


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


    q.Open;


    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

    More Delphi-Kylix Articles
    More By David Web


     

    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...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek