网络授权的一种写法

if (总_36_da <  TimeCurrent() )
   {
      CheckSwitch = false ;
      总_36_da=TimeCurrent() + MinutesForWebCheck * 60;//45min
      if ( MQLInfoInteger(6) == 0 )
      {
         子_1_st = NULL ;
         子_3_st = "User-Agent: Mozilla/4.0\r\n" ;
         子_6_in = 0 ;
         子_7_st = "http://xxx.com/answer2.php?account=" + IntegerToString(AccountInfoInteger(0),0,32);
         ResetLastError();
         子_8_in = 5000 ;
         子_6_in = WebRequest("GET",子_7_st,子_3_st,5000,子_4_ch_ko,子_5_ch_ko,子_2_st) ;
         if ( 子_6_in == -1 )
         {
            Print("Error in WebRequest. Error code  =",GetLastError()); 
            Print("Add the address \'" + 子_7_st + "\' in the list of allowed URLs on tab \'Expert Advisors\'","Error",64); 
            MessageBox("Add the address \'" + 子_7_st + "\' in the list of allowed URLs on tab \'Expert Advisors\'","Error",64); 
         }
         else
         {
            PrintFormat("The file " + IntegerToString(MagicNumber,0,32) + "qs.bin" + " has been successfully loaded, File size =%d bytes.",ArraySize(子_5_ch_ko)); 
            子_9_in = FileOpen(IntegerToString(MagicNumber,0,32) + "qs.bin",6) ;
            if ( 子_9_in != -1 )
            {
               FileWriteArray(子_9_in,子_5_ch_ko,0,ArraySize(子_5_ch_ko)); 
               FileClose(子_9_in); 
            }
            else
            {
               Print("Error in FileOpen. Error code=",GetLastError()); 
            }
         }
         子_10_in = 0 ;
         子_11_in = 0 ;
         子_10_in = FileOpen(IntegerToString(MagicNumber,0,32) + "qs.bin",49) ;
         if ( 子_10_in != -1 )
         {
            while (!(FileIsEnding(子_10_in)))
            {
               子_13_st = FileReadString(子_10_in,0) ;
            }
         }
         else
         {
            PrintFormat("3-Error code = %d",GetLastError()); 
         }
         子_14_st = "" ;
         子_11_in = 0 ;
         临_in_1=StringLen(子_13_st)  - 6; 
         for ( ; 子_11_in < StringLen(子_13_st)  - 6 ; 子_11_in = 子_11_in + 1)
         {
            if ( StringSubstr(子_13_st,子_11_in,6) == "<body>" )
            {
               子_14_st = StringSubstr(子_13_st,子_11_in + 6,1) ;
            }
         }
         if ( 子_14_st == "1" )
         {
            CheckSwitch = true ;
         }
         FileClose(子_10_in); 
         if ( FileDelete(IntegerToString(MagicNumber,0,32) + "qs.bin",0) == false )
         {
            Print("1-Error deleting:" + IntegerToString(MagicNumber,0,32) + "qs.bin" + " Error code=",GetLastError()); 
         }
      }
      else
      {
         if ( MQLInfoInteger(6) == 1 )
         {
            CheckSwitch = true ;
         }
      }
      Print("Enable trading: ",CheckSwitch); 
      if ( CheckSwitch == 0 )
      {
         Print("Invalid or expirated account number."); 
         Comment("Invalid or expirated account number."); 
         return;
      }
      Comment("Running."); 
   }
本博客所有文章如无特别注明均为原创。作者:天泓评测
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)