Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2007
    Posts
    6

    Question Unanswered: setting up date expiration on Ms access

    Hi,

    can anyone help me for a code how to setup a date expiration on my database. I want to run it for 1 month only then after that he will ask for a password before he can use it again.


    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    it is quite simple to do this approximately, but a cunning user can extend the 'demo' period by careful manipulation of the system clock. the best workaround i know for this is to limit time AND number of starts.

    the scheme requires a strong hash algorithm plus four secrets.

    make a one-record table tblDemo with fields
    idDemo, long = 1 (this is the only record that will ever be in the table)
    dtMax, datetime, the datetime your demo expires
    dtBye, datetime, the datetime the application was last quit
    intMax, integer, maximum number of starts permitted
    intNow, integer, the number of starts used so far
    hDtMax, string = stronghash(dtMax & secret1)
    hDtBye, string = stronghash(dtBye & secret2)
    hIntMax, string = stronghash(intMax & secret3)
    hIntNow, string = stronghash(intNow & secret4)

    it should be obvious how you check system time vs dtMax and intNow vs intMax.

    dtBye is there to minimise the user's freedom to set the clock backwards: if Now() < dtBye then 'using is cheating.

    the four hashes are there to stop the user interfering with the dates/counts in the table: if a newly generated hash doesn't agree with the saved hash, the user has been poking around in your table.

    the four secrets are there to muddy the water a bit. avoid embedding strings in your application - they are too easy to find. you can make simple secrets messing with a few constants
    cst1 = 23
    cst2 = 9
    cst3 = 17
    secret1 = cstr(cst1/cst9)
    etc...

    for the strong hash, you can talk directly to the win API if you are courageous or use the falling-off-a-log simple CAPICOM interface.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jan 2007
    Posts
    6
    Hi,

    Hmmm. Im little confused on the instruction you want me to do.
    Can you explain it further?

    Many thanks

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if your question is will i write it for you then the answer is firmly no!. i don't want to be responsible for your security mechanism: its your risk; your decision; your code; your problem!

    if you want to see outline approaches of how a one-record table plus strong hashing might result in a demo and/or licencing scheme, then i have posted here and here on this topic. you will see from these posts that neither of the original questioners were satisfied (they seem to have expected me to write finished code for them).

    all i can do is assure you that with a little research on CAPICOM, WMI, WSH and a few API calls you can come up with a licence/demo scheme that will withstand any number of attacks by a gifted amateur but that will fail miserably when tackled by a pro-hacker with decent tools (the same is pretty much true of all protection schemes - they help honest people to remain honest, but they cant stop the serious folk wearing black hats)

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10

    What if...

    I'm not sure this will work - but here's what I'd try anyway.

    when the database is first initialised (startup for On_Load)
    You could have some validation using the Datediff and Date() functions.

    Perhaps when the database is initialised tfor the very first time you could store the initialised date in a global/public variable. you could then use the datediff and Date functions to work out what to do accordingly.

    Eg
    initDate = theGlobalVariable
    Datevar = Date()

    If datediff(initDate, Datever) > 31 Then
    ' ' ' Open password form
    Else
    ' ' ' Open logon form
    End if

    sorry that this is a bit wishy-washy but I'm a bit rusty on my VB functions since I started my FoxPro "adventure" :P

    goodluck - george

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •