Ummm ... commenting out the programming will be hard. It's the programming that let's the form exit button work with XLOOKUPS and XPOSTS. I'll fiddle with it and see what I can take out.
I copy and pasted the programming from another form that works just fine. Here's my code:
var vPwdChk as string
var vPwdLvl as String
var vPwdDate as string
var vFileGo as int
var vFileEntry as string
vSuccess = 0
vPwdLvl = @XLOOKUP("c:\sesame\data\ICC Staff.db",User,"ICC Staff!Col#","AccessLvl")
vPwdChk = @XLOOKUP("c:\sesame\data\ICC Staff.db",User,"ICC Staff!Col#","Password")
vPwdDate = @XLOOKUP("c:\sesame\data\ICC Staff.db",User,"ICC Staff!Col#","PwdSetDate")
if vChars = vPwdChk and vPwdLvl = @userid Then
{
vChars=""
vSuccess = 1
// Write to Log file
vFileEntry = @Newline()+"Login Successful: "+@date + " -- " + @time + " -- " + @FN + " -- " + @userid + " -- " + user
vFileGo = fileopen("C:\sesame\logins.txt")
if vFileGo >= 0
{
fileseek(vFileGo, filesize(vFileGo))
fileWrite(vFileGo, vFileEntry)
fileClose(vFileGo)
}
// Create Login ID file
FileClose(vFileGo)
FileDelete("C:\sesame\user.txt")
vFileGo = fileopen("c:\sesame\user.txt")
if vFileGo >= 0
{
fileseek(vFileGo, filesize(vFileGo))
filewrite(vFileGo, ToUpper(user))
fileclose(vFileGo)
}
// Check to see if password has expired or no password exists
if (@date - 90) > vPwdDate or vPwdChk = "" then
{
vSuccess = 0
@MsgBox("Password has expired!","Select a new password","Six characters in length that is alpha and numeric")
Visibility(NewPassword,1)
Visibility(ConfPassword,1)
Visibility(SetPassword,1)
Visibility(Password,0)
ThrowFocus(NewPassword)
}
}
if vSuccess = 1 then vSuccess = @SelectTreeItem("ICC Staff!Forms!Search/Update!Staff!ICC Staff")
If vSuccess = 0 Then
{
vAttempts = 1 + vAttempts
if vAttempts = 5 THEN
{
@MsgBox("FIVE FAILED LOGIN ATTEMPTS!","ADMINISTRATION NOTIFIED!","THIS ACCOUNT IS NOW LOCKED!")
XPOST("c:\sesame\data\ICC Staff.db",User,"ICC Staff!Col#","LOCKED999","Password","")
XPOST("c:\sesame\data\ICC Staff.db",User,"ICC Staff!Col#","1999/01/01","PwdSetDate","")
vFileEntry = @NewLine() + "ACCOUNT LOCKED: " +@date + " -- " + @time + " -- "+ @userid + " -- " + user
vFileGo = fileopen ("C:\sesame\logins.txt")
if vFileGo >=0
{
fileseek(vFileGo, filesize(vFileGo))
fileWrite(vFileGo, vFileEntry)
fileClose(vFileGo)
}
vFileGo = @sendmail("mail.nas.net"," ACCOUNT LOCKED","blair1@icc.nas.net","support@intercanadacredit.com","rick@intercanadacredit.com"," blair@intercanadacredit.com",vFileEntry)
@DeferredMacro("C:\sesame\data\ExitMacro.mac")
}
// Write Failed Login to Log file
vFileEntry = @Newline()+"Login Failed: "+@date + " -- " + @time + " -- " + @FN + " -- " + @userid + " -- " + user + " -- Attempt " + vAttempts
vFileGo = fileopen("C:\sesame\logins.txt")
if vFileGo >= 0
{
fileseek(vFileGo, filesize(vFileGo))
fileWrite(vFileGo, vFileEntry)
fileClose(vFileGo)
}
if vChars <> vPassword Then @Msgbox("Invalid Password","Failed Login Attempts: "+vAttempts,"Try Again")
if @userid <> vPwdLvl Then @Msgbox("User Level Incorrect","Failed Login Attempts: "+vAttempts,"Try Again")
vChars = ""
Clear(Password)
ThrowFocus(Password)
}