Jump to content

How can i compare results


Recommended Posts

Hello, im trying to make a very simple license system hehe.

The objetive is read from website if i added a permision for that uniqueID machine (This part works)

https://prnt.sc/we70zb

Here starts the problem, when im comparing each result with the current ID, all are showed as false.

I know this should be Correct result number 4, but it is not :(

https://prnt.sc/we73nc

#include <APIDiagConstants.au3>
#include <WinAPIDiag.au3>
#include <IE.au3>
#include <Inet.au3>
#include <array.au3>
#include <MsgBoxConstants.au3>

$myHWID = (_WinAPI_UniqueHardwareID())

;~ ConsoleWrite($myHWID)

$source = _INetGetSource("http://webfortesting3265.cloudaccess.host/database.txt")

;~ MsgBox(0,"info",$source ,0,0)

Check_Active_License()

Func Check_Active_License()

   Local $license[0] = StringSplit($source, ",")

    For $i = 1 To $license[0]

       If ($myHWID = $license[$i]) Then
          ConsoleWrite('Found')
       Else
          MsgBox(0,"Your HWID: " & $myHWID, 'Any coincidence with ' & $license[$i] )
      EndIf

    Next
 EndFunc

 

Link to comment
Share on other sites

From StringSplit documentation:

If you use an empty string "" for the delimiters, each character will be returned as an element.

You possibly forgot to add "," as delimiter

Edited by GokAy
Link to comment
Share on other sites

That works well for me :

#include <WinAPIDiag.au3>
#include <Inet.au3>
#include <array.au3>
#include <MsgBoxConstants.au3>

$myHWID = (_WinAPI_UniqueHardwareID())

;~ ConsoleWrite($myHWID)

$source = _INetGetSource("http://webfortesting3265.cloudaccess.host/database.txt")

Check_Active_License()

Func Check_Active_License()

  $source = StringReplace($source, @LF, "")
  ConsoleWrite(@extended & @CRLF)
  Local $license = StringSplit($source, ",")
  ConsoleWrite(_ArrayToString($license) & @CRLF)
  For $i = 2 To $license[0] - 1
    If ($myHWID = $license[$i]) Then
      ConsoleWrite('Found')
    Else
      ;MsgBox(0,"Your HWID: " & $myHWID, 'Any coincidence with ' & $license[$i] )
    EndIf
  Next
EndFunc   ;==>Check_Active_License

 

Link to comment
Share on other sites

Alternative way

#include <WinAPIDiag.au3>
#include <Inet.au3>
#include <array.au3>
#include <MsgBoxConstants.au3>

$myHWID = (_WinAPI_UniqueHardwareID())

;~ ConsoleWrite($myHWID)

$source = _INetGetSource("http://webfortesting3265.cloudaccess.host/database.txt")

Check_Active_License()

Func Check_Active_License()
   If StringRegExp($source, '(?im)^\Q' & $myHWID & '\E') Then
      ConsoleWrite('Found')
    Else
      ;MsgBox(0,"Your HWID: " & $myHWID, 'Any coincidence with ' & $license[$i] )
    EndIf
EndFunc   ;==>Check_Active_License

 

Link to comment
Share on other sites

it is working now a bit weird, it can compare correctly but the result is the web line number. (4) (5) (11) etc, depending where i put the correct ID in the web.

Do you know how convert the result it in to a variable just  $high_permission =  true or false.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...