Jump to content
Sign in to follow this  
Iznogoud

Program security: Stop working after specific date

Recommended Posts

Iznogoud

Good day,

I have a question about securing my programs.

I want to secure my program's so other people won't redistribute it or use it for personal gain.

To do so i was wondering how and the simple and easiest way is i think to check against a specific date.

For an example:

$DATE=@MDAY & @MON & @YEAR
If $DATE > 01012009 Then
    MsgBox(4096,"", "Value is positive.")
ElseIf $DATE < 0 Then
    MsgBox(4096,"", "Value is negative.")
EndIf

But the value will always be possible, so what am i missing from this o simple script?

The date when the program will stop working is in this example 01012009.

Sorry for this noob question but i am missing something and i am not seeing it.

Share this post


Link to post
Share on other sites
evilertoaster

thinks about it, your date variable will be 25021008 ( 25 02 2008) if it's ran today. This is indeed a higher number than 1012009 ( 01 12 2009).

The date managment UDF might provide some more helpfull functions for date handling. But in particular, if you are comparing an interger, you'll probably want to do it in a yyyymmdd order so that 20090101 ( 2009 01 01) is greater than 20080101 (2008 01 01).

Edited by evilertoaster

Share this post


Link to post
Share on other sites
Paulie

It would be better to compare each individually, because with you method, 01012009 (january 1 2009) would be less than 09092010 (sept. 9 2008) which is actually a later date

My solution

$Cutoff = "01|01|2009"; D|M|Y
$Date = StringSplit($Cutoff, "|")
If @MDAY >= $Date[1] then
If @MON >= $Date[2] then
If @YEAR >= $Date[3] then 
Msgbox(0, "Expired", "Sorry, your trial has expired.")
Exit
EndIf
EndIf
EndIf

Edit: Forgot quotes

Edited by Paulie

Share this post


Link to post
Share on other sites
Iznogoud

thinks about it, your date variable will be 25021008 ( 25 02 2008) if it's ran today. This is indeed a higher number than 1012009 ( 01 12 2009).

The date managment UDF might provide some more helpfull functions for date handling. But in particular, if you are comparing an interger, you'll probably want to do it in a yyyymmdd order so that 20090101 ( 2009 01 01) is greater than 20080101 (2008 01 01).

Sorry my bad, if i just made the time to write it down i think i would see the problem. Sorry for my stupidty.

I know better.

It would be better to compare each individually, because with you method, 01012009 (january 1 2009) would be less than 09092010 (sept. 9 2008) which is actually a later date

My solution

$Cutoff = "01|01|2009"; D|M|Y
$Date = StringSplit($Cutoff, "|")
If @MDAY >= $Date[1] then
If @MON >= $Date[2] then
If @YEAR >= $Date[3] then 
Msgbox(0, "Expired", "Sorry, your trial has expired.")
Exit
EndIf
EndIf
EndIf

Edit: Forgot quotes

Thank you for this and i will try this for myself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.