A very simple password management system that I wrote using Microsoft Visual Foxpro 9 which allows the user to register information and upload pictures. This application can be used to protect your database application from unauthorized users in your system.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.
Sample Program Output, Table Structure and Sample Records
Program Listing
Password.scx
============
Object : Form1 Procedure: Init
SELECT 1
USE users
thisform.text2.value =0
thisform.text2.Visible= .F.
thisform.txtusername.SetFocus
READ events
Ok Button
========
Object : Command1 Procedure: Click
SET DEFAULT TO d:\vfp\password\
SELECT users
LOCATE FOR ALLTRIM(LOWER(username)) == ALLTRIM(LOWER(thisform.txtusername.value)) AND ALLTRIM(LOWER(password)) == ALLTRIM(LOWER(thisform.txtpassword.Value))
IF FOUND() then
DO form menu
thisform.Release
thisform.Hide
RETURN .t.
endif
if thisform.text2.Value <3 then
thisform.text2.Value = thisform.text2.Value +1
thisform.txtusername.Value=""
thisform.txtpassword.Value =""
thisform.txtusername.SetFocus
thisform.label1.caption ="User login attempt number " + TRANSFORM(thisform.text2.value) + "."
endif
IF thisform.text2.Value = 3 then
MESSAGEBOX("Please contact your programmer to solve this problem")
thisform.txtusername.Enabled= .F.
thisform.txtpassword.Enabled= .F.
thisform.command1.Enabled= .F.
ENDIF
Register Button
===============
Object: Command3 Procedure: Click
thisform.Release
thisform.hide
DO FORM record_management
Cancel Button
=============
Object: Command2 Procedure: Click
thisform.Release
CLEAR EVENTS
CLOSE ALL
Quit
record_management.scx
=====================
New Button
============
Object: Command2 Procedure: Click
thisform.txtId.value=0
thisform.txtUsername.value=""
thisform.txtPassword.value=""
thisform.txtLastname.value=""
thisform.txtFirstname.value=""
thisform.txtPixpath.value=""
thisform.txtId.setfocus
Grid
=====
Object: grdUsers Procedure: Click
SELECT users
thisform.txtId.Value=id
thisform.txtUsername.Value = username
thisform.txtPassword.Value = password
thisform.txtLastname.Value = lastname
thisform.txtFirstname.Value = firstname
thisform.txtPixpath.Value = pixpath
Save Button
============
Object: Command3 Procedure: Click
SELECT users
locate for id == thisform.txtId.value
if !found()
&& new record
if Messagebox("Are you sure to add new record?",32+4,"Confirmation") = 6
append blank && add new record
replace id WITH thisform.txtId.Value
replace lastname WITH UPPER(ALLTRIM(thisform.txtLastname.value))
replace firstname WITH UPPER(ALLTRIM(thisform.txtFirstname.Value))
replace username WITH thisform.txtUsername.Value
replace password WITH thisform.txtPassword.Value
replace pixpath WITH thisform.txtPixpath.value
endif
else && update record
if Messagebox("Are you sure to update existing record?",32+4,"Confirmation") = 6
replace id WITH thisform.txtId.Value
replace lastname WITH UPPER(ALLTRIM(thisform.txtLastname.value))
replace firstname WITH UPPER(ALLTRIM(thisform.txtFirstname.Value))
replace username WITH thisform.txtUsername.Value
replace password WITH thisform.txtPassword.Value
replace pixpath WITH thisform.txtPixpath.value && overwrite existing record
endif
endif
thisform.grdUsers.refresh
Delete Button
============
Object: Command4 Procedure: Click
select users
SET DELETED on
locate for id = thisform.txtId.value
if found()
if Messagebox("Are you sure to delete this record?",32+4,"Confirmation") = 6
delete
endif
ENDIF
thisform.txtId.value=0
thisform.txtUsername.value=""
thisform.txtPassword.value=""
thisform.txtLastname.value=""
thisform.txtFirstname.value=""
thisform.txtPixpath.value=""
thisform.txtId.setfocus
thisform.refresh
thisform.grdusers.refresh
Close Button
============
Object: Command5 Procedure: Click
thisform.Release
DO FORM password
PixPath Button
==============
Object: Command1 Procedure: Click
thisform.txtPixpath.value = GETPICT()
thisform.txtPixpath.Refresh
menu.scx
========
Object: Form1 Procedure: Init
SELECT users
fullname = TRIM(firstname) + " " + TRIM(lastname)
thisform.label1.Caption = "Welcome " +fullname
thisform.image1.Picture=TRIM(pixpath)
thisform.image1.Visible= .T.
Close Button
===========
Object: Command1 Procedure: Click
thisform.Release
thisform.hide
DO FORM password
No comments:
Post a Comment