axxbryan Posted January 1, 2021 Share Posted January 1, 2021 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 More sharing options...
Nine Posted January 1, 2021 Share Posted January 1, 2021 Because there is @CRLF at the end of each line, you need to remove that before splitting. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
axxbryan Posted January 1, 2021 Author Share Posted January 1, 2021 sorry but, how should be wrote? Link to comment Share on other sites More sharing options...
Nine Posted January 1, 2021 Share Posted January 1, 2021 $source = StringReplace($source, @LF, "") ConsoleWrite ("number of replace = " & @extended & @CRLF) It seems there is only @LF . “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
axxbryan Posted January 1, 2021 Author Share Posted January 1, 2021 its not working now it print letter by letter Link to comment Share on other sites More sharing options...
GokAy Posted January 1, 2021 Share Posted January 1, 2021 (edited) 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 January 1, 2021 by GokAy Link to comment Share on other sites More sharing options...
Nine Posted January 1, 2021 Share Posted January 1, 2021 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 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mikell Posted January 1, 2021 Share Posted January 1, 2021 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 axxbryan 1 Link to comment Share on other sites More sharing options...
axxbryan Posted January 1, 2021 Author Share Posted January 1, 2021 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 More sharing options...
axxbryan Posted January 1, 2021 Author Share Posted January 1, 2021 Mikell i dont undertand the code but that work perfect. Thanks everyone. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now