asp生成不需要数据库的中奖码

2019-01-13 12:13:54丽君

function GetRnd(min,max)
    Randomize
    GetRnd = Int((max - min + 1) * Rnd + min)
end function

function getrnddatenum()
    getrnddatenum = CFTGetServerDate(now) & CFTGetServertime(now) & GetRnd(1000,9999)
end function

'PrivateKey,尽量复杂一些,开始使用后,就不能更改了。
dim keyinfokey
keyinfokey = "51windows.net@1234567890!@#$%^&*()QWERFGHJK"

'得到中奖码
function getkey()
    skey = getrnddatenum()
    skey2 = md5(skey & keyinfokey)
    getkey = skey & skey2
end function


'验证中奖码
function ckkey(s)
    strs = s
    if len(strs)<> 34 then
        ckkey = false
        exit function
    end if
    datenum = left(strs,18)
    md5oldstr = right(strs,16)
    md5str = md5(datenum & keyinfokey)
    if lcase(md5str) = lcase(md5oldstr) then
        ckkey = true
    else
        ckkey = false
    end if
end function
%>

您可能感兴趣的文章:

php实现可以设置中奖概率的抽奖程序代码分享PHP大转盘中奖概率算法实例phpQuery让php处理html代码像jQuery一样方便PHP+jQuery+Ajax实现多图片上传效果PHP结合jQuery.autocomplete插件实现输入自动完成提示的功能php+ajax+jquery实现点击加载更多内容php编写的抽奖程序中奖概率算法基于JQuery+PHP编写砸金蛋中奖程序