Announcement

Collapse
No announcement yet.

Licensing issue, so close but really could do with help, will pay

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Licensing issue, so close but really could do with help, will pay

    Hey guys, been working on a licensing system and things were going great, then my son-in-law died and everything has gone to Sh*t, family is broken, I'm on antidepressants and feeling like a zombie and unable to focus like I did before. Maybe this licensing code might help someone else too, see I do make an effort

    The problem

    Check to see if software is registered by checking inifile (if it exists)
    if license is found in inifile
    check license online
    if license is incorrect exit APP
    else continue

    The problem I have though is if a bogus license is in the inifile, detecting that and shutting down.
    Sorry mentally exhausted and finding all of this a struggle.

    Code:
    status = INIFile.GetValue(_SourceFolder .. "\\settings.ini","Registration", "license");
    if status ~= "" then
    Dialog.Message("Notice", status);
    checkini = {key="secretkey", license = status , application = "mysoftware", compid="compid"};
    testresult = HTTP.SubmitSecure("https://mysite.com/activate", checkini, SUBMITWEB_POST, 20, 443, nil, nil);
    Dialog.Message("Notice", testresult);
    strSearchIn = testresult;
    strSearchFor = "Invalid License Key";
    
    -- search for strSearchFor inside strSearchIn
    nFoundPos = String.Find(strSearchIn, strSearchFor);
    Dialog.Message("Search Result", nFoundPos .. " License not found");
    if nFoundPos > 0 then
    Dialog.Message("Search Result", strSearchFor .. " License not found");
    Application.Exit();
    
    else
    license = Dialog.Input("Enter transid", "Transid:", "", MB_ICONQUESTION);
    registration = {key="secretkey", license = license , slug = "mysoftware", compid="compid"};
    result = HTTP.SubmitSecure("https://mysite.com/activate", registration, SUBMITWEB_POST, 20, 443, nil, nil);
    --Dialog.Message("Notice", result);
    valid = String.Mid(result, 10,4);
    if valid == "true" then
    Dialog.Message("Notice", "Thank you, your software is now registered", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    INIFile.SetValue(_SourceFolder .. "\\settings.ini", "registration", "license", license);
    else
    Dialog.Message("Notice", "Your license appears to be invalid, please contact support", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Application.Exit();
    
    end
    end
    end
    Appreciate any help and will pay for a solid solution, just can't focus at this time.

    Thanks Rob

  • #2
    Worked it out no need to reply Cheers

    Comment

    Working...
    X