Home arrow Delphi-Kylix arrow Page 2 - Constructing the Interface for an Internet Access Control Application
DELPHI-KYLIX

Constructing the Interface for an Internet Access Control Application


In this third part to a six-part article that shows how to build an application for Internet access control, such as you might find in an Internet cafe, we will mainly be dealing with the functionality of the main server application. This is the application that will provide us with both the interface and capability to manage client sessions.

Author Info:
By: David Web
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
September 02, 2008
TABLE OF CONTENTS:
  1. · Constructing the Interface for an Internet Access Control Application
  2. · The Main Server Application
  3. · Code continued
  4. · Still More Code
  5. · Code Concluded

print this article
SEARCH DEVARTICLES

Constructing the Interface for an Internet Access Control Application - The Main Server Application
(Page 2 of 5 )



Listing 1: Main server application

unit server;


interface


uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer,

IdCmdTCPServer, Menus, ComCtrls,idcommandhandlers, ImgList, Buttons, ToolWin, StdCtrls,idcontext,idsync,idStack,

ExtCtrls,dateutils, DB, ADODB;


type

TMyContext = class(TIdContext)

public

IP: String;

Con: TDateTime;

compname:string;

// state:string;

end;



TLog = class(TIdSync)

protected

FMsg: String;

procedure DoSynchronize; override;

public

constructor Create(const AMsg: String);

class procedure AddMsg(const AMsg: String);

end;



TForm1 = class(TForm)

lv: TListView;

MainMenu1: TMainMenu;

File1: TMenuItem;

ImageList1: TImageList;

ToolBar1: TToolBar;

Exit1: TMenuItem;

LogOff1: TMenuItem;

Settings1: TMenuItem;

ts: TIdTCPServer;

newOp: TSpeedButton;

btnExit: TSpeedButton;

Memo1: TMemo;

activate: TSpeedButton;

Timer1: TTimer;

PopupMenu1: TPopupMenu;

AddClient1: TMenuItem;

StatusBar1: TStatusBar;

ado1: TADOTable;

View1: TMenuItem;

Stats1: TMenuItem;

About1: TMenuItem;

iCafeStation1: TMenuItem;

shut_down: TSpeedButton;

constructor Create(AOwner: TComponent);override;

procedure Exit1Click(Sender: TObject);

procedure Settings1Click(Sender: TObject);

procedure LogOff1Click(Sender: TObject);

procedure tsConnect(AContext: TIdContext);

procedure tsDisconnect(AContext: TIdContext);

procedure BitBtn2Click(Sender: TObject);

procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure tsExecute(AContext: TIdContext);

procedure newOpClick(Sender: TObject);

procedure btnExitClick(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure activateClick(Sender: TObject);

procedure AddClient1Click(Sender: TObject);

procedure lvDblClick(Sender: TObject);

procedure shut_downClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

level:string;

li:tlistitem;

WStation,tcharge,mins:string;

tAll:integer;

td,endtime:tdatetime;

uid:integer;

procedure Timing(theStation,charge,thetime:string);

procedure broadcastAll;

end;


var

Form1: TForm1;

theT:string;

implementation


uses Logon, adduser, settings, changepassword, newUser, addoperator;


{$R *.dfm}


procedure TForm1.broadcastAll;


var

List: TList;

Context: TMyContext;

I: Integer;

begin

// FContextList is inherited from TIdContext

List := form1.ts.Contexts.LockList;

try

for I := 0 to List.Count-1 do

begin

Context := TMyContext(List[I]);

try

Context.Connection.IOHandler.WriteLn('shutdown:end@plchldr');


except end;

end;

finally

form1.ts.Contexts.UnlockList;

end;

end;


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