我如何在不使用系统日期时间的情况下计算许可证的试用期 [英] how can i calculate the trial period of the license without using system datetime

查看:180
本文介绍了我如何在不使用系统日期时间的情况下计算许可证的试用期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我给我的软件试用期.该试用期是根据系统日期时间计算的,但是当我更改系统日期时间(如果小于当前日期)时,软件试用期将延长.如果我更改系统日期时间& amp;,则该日期时间将于2011年3月3日结束.将其设置为03/april/2011,然后将试用期延长30天.解决方案.

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.

推荐答案

不要信任您的用户!

记录上次使用的日期/时间(开始和结束),如果新日期没有在此之后,则失败.

只需记住允许夏令时,否则您会惹恼很多人...
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...


一个简单的解决方案是存储应用程序的安装,首次运行和安装日期.上次运行.从那里开始,系统日期更改后,您将获得一些依据.例如,如果系统日期早于安装日期,则应该引起一些怀疑.

以下是有关它的文章.它是用VB.Net编写的,但是应该很容易理解.

http://www.dreamincode.net/forums/topic/65721-trial-period/ [ ^ ]
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/[^]


一种解决方案是将软件启动的最后一个系统日期(在注册表或隐藏文件中)存储,并将该日期与当前日期进行比较,以防止他人作弊.

让我们看一个例子:

-假设您的应用程序安装程序在注册表中存储了安装日期" 值.
-您还将存储另一个值:上次启动" .您应该(在设置中)使用与安装日期" 相同的值对其进行初始化.

每次您的应用程序启动时:
-从注册表中读取上次启动" 值.将其与当前系统日期进行比较.如果小于或等于当前系统日期,则继续正常进行.如果更大,则表示用户作弊并更改了系统日期:然后,您可以显示错误消息或其他内容.
-如果初始化应正常进行,请使用当前系统日期更新注册表中的上次启动" 值.
-之后,您可以将当前系统日期安装日期" 进行比较,以了解试用期是否仍然有效.

您当然应该不要在卸载工具中从系统中删除注册表值,否则用户可以根据需要多次重新安装您的应用程序,这将重置注册表值...
而且,您的设置程序不应覆盖这些值(如果它们已经存在,则表示该软件已经安装)

为了进一步保护,还可以使名称安装日期" ,...不太明显.这将阻止用户找到并手动更改它们.

这是一种解决方案.
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.


这篇关于我如何在不使用系统日期时间的情况下计算许可证的试用期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆