Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Dale Dedoroy
  Where is Dale Dedoroy?
 Bacolod City, Negros Occidental
 Philippines
 Dale Dedoroy
 To: Joriveek Joriveek
  Where is Joriveek Joriveek?
 
 Argentina
 Joriveek Joriveek
 Tags
Subject: RE: Table Properties
Thread ID: 22110 Message ID: 22174 # Views: 16 # Ratings: 0
Version: Visual FoxPro 7 Category: Databases, Tables and SQL Server
Date: Friday, April 11, 2003 2:17:15 AM         
   


>
> That's fine, it doesn't seem to be working if someone try to manipulate my data by simply using BROWSE either from command windows or alternatively they can either open that specific table from the explorer if they have Visual Foxpro on their machine!
>
> Can we do anything for that?
>
> Thanks
> J.
>
>
> > > Hi Group,
> > >
> > > I have created a mydatabase.dbc, which contains a couple of Tables. Now When I open a single table, say mytable1.dbf from Windows Explorer, it opens with Visual FoxPro and I can simply change the data and even it did not bother to ask me whether to save messagebox with Yes, No, Cancel. Why FoxPro doesn't provide minimum security to the data at all? I have a stand along application running on a PC and I don't want my end user of the application to access the tables directly without the Inteface application. How can I protect the data in the *.dbf files on my PC?
> > >
> > > Thanks
> > > J.
> >
> > Try these:
> >
> > Modify Database YourDatabase
> >
> > Then right click and select "Edit Stored Procedures"
> >
> > Cut these lines of codes and paste it to stored procedure editor:
> >
> > PROCEDURE dbc_BeforeOpenTable(cTableName)
> > Local lcPassword
> > lcPassword = ''
> > If !InputBox('Enter password:','Database Security',lcPassword) == "PASSWORD"
> > Return .F.
> > EndIf
> > Return .T.
> > EndProc
> > **** end of procedure****
> >
> > Press CTRL-W twice.
> >
> > In the command window,
> > USE AnyTable
> >
> > Remember that password is case sensitive. Goodluck.
> >
> > Dale
> >
> > "Man's mind once stretched by a new idea never regains its original dimension."

Sorry. Forgot to tell you that you have to activate the DBC's events. Okay, modify the database again, right-click and properties and check the "Set Events On". Another thing, the dbc_BeforeOpenTable event will still fire even you access DBC-bound table thru your application. I suggest that you create a Public variable in your main prg, say, goMainAppInstance then initialize it as an object: goMainAppInstance = CreateObject("line") && I use line object here having the least number of properties and methods.

Slight modify the above codes like this:

PROCEDURE dbc_BeforeOpenTable(cTableName)
If VarType(goMainAppInstance) # 'O'
Local lcPassword
lcPassword = ''
If !InputBox('Enter password:','Database Security',lcPassword) == "PASSWORD"
Return .F.
EndIf
EndIf
Return .T.
EndProc
**** end of procedure****

Goodluck.

Dale

"Man's mind once stretched by a new idea never regains its original dimension."

COMPLETE THREAD

Table Properties Posted by Joriveek Joriveek @ 4/9/2003 6:04:04 PM
RE: Table Properties Posted by Dale Dedoroy @ 4/9/2003 7:46:41 PM
RE: Table Properties Posted by Joriveek Joriveek @ 4/10/2003 11:41:23 AM
RE: Table Properties Posted by Dale Dedoroy @ 4/11/2003 2:17:15 AM
RE: Table Properties Posted by Joriveek Joriveek @ 4/11/2003 1:09:38 PM
RE: Table Properties Posted by Joriveek Joriveek @ 4/11/2003 1:31:33 PM