Sign in to follow this  
Followers 0
xanathos

Multiple loops conditions

8 posts in this topic

#1 ·  Posted (edited)

Hello there!

First here is my code:

Func _OpenLink()
Local $OkChk
Local $iOk = 0
Local $array = FileReadToArray($Source)


Global Const $sUserName = "", $sPassword = "" ; set correct
$aListView = _GuiCtrlListView_CreateArray($hListView, Default)
$hSession =  _WinHttpOpen("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240", $WINHTTP_ACCESS_TYPE_NAMED_PROXY, Guictrlread($h_sProxy) & ":" & GuiCtrlRead($h_iPort))
$sHost = '127.0.0.1'
$sReq = _WinHttpConnect($hSession, $sHost, $INTERNET_DEFAULT_HTTPS_PORT)


For $i = 0 To UBound($array) - 1
    if $i > 0 Then
$sResponse = _WinHttpSimpleSSLRequest($sReq, 'GET', 'check=' & $array[$i] & @CRLF)

$ExpDate = _StringBetween($sResponse,'"exp":"', '"}')
$Type = _StringBetween($sResponse,'"type":"', '"')
            If StringInStr($sResponse, 'true') Then
                $iOk += 1
                $GetIt = GUICtrlCreateListViewItem($array[$i] & "| Yes" & "|" & $ExpDate[0] & "|" & $Type[0], $hListView)
                FileWrite($Dest, $array[$i] & " | " & $ExpDate[0] & " | " & $Type[0] & @CRLF)
                SoundPlay("s3.wav")
                EndIf
            If StringInStr($sResponse, 'used') Then
                GUICtrlCreateListViewItem($array[$i] & "| Used" & "|" & $ExpDate[0] & "|" & $Type[0], $hListView)
                EndIf
            If StringInStr($sResponse, 'not available') Then
                GUICtrlCreateListViewItem($array[$i] & "| Non available" & "|" & $ExpDate[0] & "|" & $Type[0], $hListView)
            EndIf
            If StringInStr($sResponse, 'unknown') Then
                GUICtrlCreateListViewItem($array[$i] & "| Unknown", $hListView)
            EndIf
EndIf

                GuiCtrlSetData($hLabel, $iOk & " ok on " & _GUICtrlListView_GetItemCount($hListView) & " on " & _FileCountLines($Source) & " - ETA: " & (((_FileCountLines($Source))-(_GUICtrlListView_GetItemCount($hListView)))*45)/60 & " minutes" )

Sleep(45000)
Next

EndFunc

What I want to do is switch between 3 proxies every 30 arrays, first proxy for first 30 arrays, second for the next 30, and 3rd for the next (Proxy 1: 0 to 30; proxy 2: 31-60; proxy 3: 61-90, then  loop that).

I tried with if $i > 30 then change the hSession variable to read $h_sProxy2 and $h_iPort2 (these are inputs for proxy 2), and if $i > 60 read $h_sProxy3, and so on, then if $i > 90, set $i to 0, but no luck, there must be somewhere where its overriden.

If someone could help, hope its not confusing.

 

Edited by xanathos

Share this post


Link to post
Share on other sites



@xanathos Care to explain just what reason you would have to continuously switch between proxies?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Our students database have a blacklisting for few hours, and being able to process through the large database without being blacklisted is a criteria for the project.

Share this post


Link to post
Share on other sites
8 minutes ago, Bert said:

and why is there a black list being created?

Gotta ask the IT guy from our school, which is pretty stupid considering the server is running local only...

Share this post


Link to post
Share on other sites

@xanathos so, the IT guy at your school is creating a blacklist, and you're looking to switch the proxies to get around that, is that the gist of it?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
1 minute ago, JLogan3o13 said:

@xanathos so, the IT guy at your school is creating a blacklist, and you're looking to switch the proxies to get around that, is that the gist of it?

Not really, its not the main purpose of the script, but to make it run in optimal way, it does require to switch between proxies, yes.

Share this post


Link to post
Share on other sites

Main purpose of the script or not, it sounds as though you are bypassing security measure put into place by your IT team, which is against our forum rules. The topic is locked until you can convince me this is not the case.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0