Iznogoud Posted February 25, 2008 Posted February 25, 2008 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.
evilertoaster Posted February 25, 2008 Posted February 25, 2008 (edited) 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 February 25, 2008 by evilertoaster
Paulie Posted February 25, 2008 Posted February 25, 2008 (edited) 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 February 25, 2008 by Paulie
Iznogoud Posted February 26, 2008 Author Posted February 26, 2008 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now