Click here to Skip to main content
15,891,811 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i give the trial period for my software. this trial period is calculated on system datetime but when i changed the system datetime(if less than current date ) the software trial period extended.on 03/may/2011 trial period is finished that datetime if i change the system datetime & set it on 03/april/2011 then the trial peroid is incresed by 30 days.What is the solution.
Posted
Comments
yesotaso 3-May-11 7:05am    
Force user to use a webcam looking at clear sky top vector to true north to decide sun position... Calculate real date from solar polar coordinate angles heading and elevation... Hmm you're gonna need cartesian coordinates of camera as well. Bah!! I give up.
Akinloluwa 26-Feb-14 4:35am    
laughing so hard right now!

Don't trust your users!

Record the last date/time it was used (start and end) and if the new time isn't after that, it fails.

Just remember to allow for Daylight Savings Time, or you will annoy a lot of people...
 
Share this answer
 
Comments
walterhevedeich 3-May-11 4:09am    
OK. You beat me to it. Have some 5. :)
Olivier Levrey 3-May-11 4:21am    
Good answer. I posted mine at the same time but I took too much time to write it :). Have a 5.
theharshvyas 6-May-16 10:04am    
what if we re-set datetime as the last time run in our system?
A simple solution would be to store the dates when the application was installed, first run, and last run. From there, you will have some basis when the system date has changed. For example, if the system date was earlier than the installed date, this should raise some suspicions.

Below is an article about it. Its written in VB.Net but it should be pretty easy to understand.

http://www.dreamincode.net/forums/topic/65721-trial-period/[^]
 
Share this answer
 
Comments
Olivier Levrey 3-May-11 4:22am    
Good answer. I posted mine at the same time but I took too much time to write it :). Have a 5.
walterhevedeich 3-May-11 5:17am    
Thanks.
Zeeshan-Ali89 23-Jan-12 5:31am    
nice i m trying this and hope it will work
One solution could be storing the last system date your software was started (in the registry or a hidden file), and compare this date to the current date to prevent people from cheating.

Let's see an example:

- Let's say your application setup stores an "Install date" value in the registry.
- You will also store another value: "Last started". You should initialize it (in your setup) with the same value as "Install date".

Each time your application starts:
- Read the "Last started" value from registry. Compare it to the current system date. If it is less or equal than current system date, then continue normally. If it is greater, it means the user cheated and changed the system date: you can then display an error message or whatever.
- If the initialization should continue normally, update the "Last started" value in the registry with the current system date.
- After that, you can compare the current system date to the "Install date" to know if the trial period is still valid.

You should of course not remove the registry values from the system in your uninstall tool, otherwise the user can re-install your application as many times as he wants and it would reset the registry values...
Moreover, your setup shouldn't overwrite these values (if they already exist, it means the software was already installed)

To protect a little bit more, you can also make the names "Install date", ..., not so obvious. This will prevent user to find them and change them manually.

This is one solution.
 
Share this answer
 
Comments
LaxmikantYadav 3-May-11 4:29am    
My +5, Good answer.
Olivier Levrey 3-May-11 4:32am    
Thank you
walterhevedeich 3-May-11 5:17am    
Have a 5. Your explanation is much clearer than my answer. :)
Olivier Levrey 3-May-11 5:20am    
Thank you. It is the same answer actually. Even though I put more details, your link contains all explanations as well ;)
Member 13346501 27-Oct-17 7:11am    
please send me and extensive explanation using c#. please.... your explanation is inspiring. but how do i store into registry.......
Jerry A.
jesyontop01@gmail.com
There are a few ways to do this;
1. Query a timeserver via sntp.
2. Use a php or asp.net script on your server to get the time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900