⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upip.pas

📁 参照上兴、鸽子等源码编写编写出来的。 编译环境:Delphi7+SP+DP+indy9等控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
end;
procedure TUpIpDate.FtpButton1Click(Sender:TObject);
begin
  if checkip then  Get_UserFile;
end;

function TUpIpDate.Update(Body,UpdateS:string):Boolean;
var
  i:integer;
begin
  result:=False;
  i:=Pos(UpdateS,Body);//Update:='修改成功'
  if i>=1 then result:=True;
end;



procedure XWDns;
var
  username,pass,Temp:string;
  tmphttp,verdns,tempip:string;
  ProxyStr:TProxyServerInf;
begin
  try
    username:=UpIpDate.Xwuser.Text;
    pass:=UpIpDate.Xwpass.Text;

    if GetDefaultProxyServer(ProxyStr) then{本地设置了代理服务器}  begin
      if ProxyStr.httpName<>'' then begin
        UpIpDate.IdHTTP2.ProxyParams.ProxyServer:=ProxyStr.httpName;
        UpIpDate.IdHTTP2.ProxyParams.ProxyPort:=ProxyStr.httpport;
      end;
    end else begin
      UpIpDate.IdHTTP2.ProxyParams.ProxyServer:='';
      UpIpDate.IdHTTP2.ProxyParams.ProxyPort:=0;
    end;
   if upipdate.outdnsip.text='' then begin tempip:=UpIpDate.XwComboBox.Text end else tempip:=upipdate.outdnsip.Text;
  if pos('3322',upipdate.xwedit.text)>0 then tmphttp:='http://www.3322.org/dyndns/update?system=dyndns&hostname='+UpIpDate.XwEdit.Text+'&myip='+tempip+'&wildcard=OFF&mx=&backmx=NO'
  else
  begin
  verdns:=Trim(Copy(upipdate.xwedit.text, 0, Pos('.', upipdate.xwedit.text) - 1));

  tmphttp:='http://www.vier.cn/service/dyndns/update.php?username='+username+'&password='+pass+'&zonename=vier.cn&hostname='+verdns;
  end;
    UpIpDate.IdHTTP2.Request.username:=username;
    UpIpDate.IdHTTP2.Request.Password:=pass;
// messagebox(0,pchar(tmphttp),'',mb_ok);
    Temp:=UpIpDate.IdHTTP2.Get(tmphttp);

    try
      UpIpDate.IdHTTP2.Disconnect;
    except
    end;

    if UpIpDate.Update(Temp,'good') or (Pos('nochg',Temp)>0) or (Pos('success',Temp)>0)
      then begin
      UpIpDate.Label1.Caption:='更新IP成功!请等待服务器上线!';

    end
    else begin
      if Pos('badauth',Temp)>0 then begin
        UpIpDate.Label1.Caption:='更新IP失败!用户名或密码不正确!';
        UpIpDate.XWButton.Enabled:=True;
        Exit;
      end;
      UpIpDate.Label1.Caption:='更新IP失败!请检查输入信息是否正确!'+Temp;
    end;
  except
    UpIpDate.Label1.Caption:='更新IP错误!请检查网络!';
  end;
  UpIpDate.XWButton.Enabled:=True;
end;

type
  TXWDnsThread=class(TThread)
  public
    procedure Execute; override;
  end;

procedure TXWDnsThread.Execute;
begin
  XWDns;
  Terminate;
end;








procedure TUpIpDate.XWButtonClick(Sender:TObject);
begin
  if XwEdit.Text='' then begin
    Label1.Caption:='对不起!好像您没有填写域名噢!请您填上吧!';
    Exit;
  end;
  if Xwuser.Text='' then begin
    Label1.Caption:='对不起!请填写用户名!';
    Exit;
  end;
  if Xwpass.Text='' then begin
    Label1.Caption:='对不起!请填写密码!';
    Exit;
  end;
  XWButton.Enabled:=False;
  Label1.Caption:='开始更新IP地址到域名...';
  TXWDnsThread.Create(False);
end;


procedure TUpIpDate.spSkinButton1Click(Sender: TObject);
begin
  outftpip.text:=ipadd+':'+FormOpciones.EditPuerto.Text;
end;

procedure TUpIpDate.spSkinButton2Click(Sender: TObject);
begin
outdnsip.text:=ipadd;
end;

procedure iptext(id:integer);
var
f:textfile;
begin
deletefile('ip.txt');
sleep(200);
Assignfile(F,'ip.txt');
if not FileExists('ip.txt') Then
begin
Rewrite(F);
Closefile(F);
End
Else  Assignfile(F,'ip.txt');
{$I-}
Append(F);
{$I+}
If IOResult<> 0 Then
Begin
Messagebox(0,'无法打开IP文件','提示',mb_ok);
End;
if id=1 then begin
if UpIpDate.outftpip.text<>'' then  Write(F,UpIpDate.outftpip.text) else
Write(F,UpIpDate.ipaddEdit.text) end;
//buffer:='';
Closefile(F);
end;

function GetOnlineStatus() : Boolean;
var ConTypes : Integer;
begin
  ConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY;
  if (InternetGetConnectedState(@ConTypes, 0) = False) then Result := False else Result := True;
end;

Function FtpConnect(hh,us,pa:pchar) : Boolean;
begin
    Result:=false;
    Session := InternetOpen('Yalong', INTERNET_OPEN_TYPE_DIRECT, '', '', 0);
    If Session = nil Then
        begin
       // SetwindowText(hwnd,'error1');
        InternetCloseHandle(Session);
        end
    Else
    begin
        Server := InternetConnect(Session,
        hh, strtoint(UpIpDate.Ftpport.Text), us, pa, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); //21 -Ftpport.Text
        If Server = nil Then
           begin
           InternetCloseHandle(Session);
           end
        Else
           result:= True;
    End;
End;
//上传文件
function FtpUp(id:integer):Boolean;
var
   Kam:string;
   hFile:HINTERNET;
   sFile:File;
   cnt:DWORD;
   Buf:array [0..1023] of byte;
   nRet:DWORD;
begin
FtpSetCurrentDirectory (Session, '/');
if id=1 then  Kam := '/' + upipdate.ipfileedit.text;
//showmessage(pchar(kam));
hFile := FtpOpenFile(Server, pchar(Kam), GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0);
   try
        Assignfile(sFile,'ip.txt');
        Reset(sFile,1);
        repeat
          BlockRead(sFile,Buf,sizeof(Buf),Cnt);
          InternetWriteFile(hFile, @(Buf[0]), Cnt, nRet);
        until Cnt<sizeof(Buf);
   finally
        Closefile(sFile);
        InternetCloseHandle(Session);
        Result:=DeleteFile('ip.txt');
   end
end;
//上传文件



procedure TUpIpDate.spSkinButton3Click(Sender: TObject);
begin
  if checkip then  idftp;
end;

procedure TUpIpDate.FormCreate(Sender: TObject);
var
  ini1:tinifile;
begin
//messagebox(0,pchar(app_path1+'Operate.ini'),'',mb_ok);
///////////////////////////////////////////
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  xwedit.Text:=ini1.ReadString('upip','xwedit',xwedit.Text);
  xwuser.Text:=ini1.ReadString('upip','xwuser',xwuser.Text);
  xwpass.Text:=ini1.ReadString('upip','xwpass',xwpass.Text);
  ftpadder.Text:=ini1.ReadString('upip','ftpadder',ftpadder.Text);
  ftpuser.Text:=ini1.ReadString('upip','ftpuser',ftpuser.Text);
  ftppass1.Text:=ini1.ReadString('upip','ftppass1',ftppass1.Text);
  ftppass2.Text:=ini1.ReadString('upip','ftppass2',ftppass2.Text);
  ftpport.Text:=ini1.ReadString('upip','ftpport',ftpport.Text);
 // oldpass.Text:=ini1.ReadString('pzh','oldpass',oldpass.Text);
  ini1.Free;
end;

procedure TUpIpDate.XwEditChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','xwedit',XwEdit.Text);
  ini1.Free;
end;
procedure TUpIpDate.XwuserChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','xwuser',Xwuser.Text);
  ini1.Free;
end;
procedure TUpIpDate.XwpassChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','xwpass',Xwpass.Text);
  ini1.Free;
end;

procedure TUpIpDate.FTPAdderChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','ftpadder',ftpadder.Text);
  ini1.Free;
end;

procedure TUpIpDate.FTPPortChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','ftpport',ftpport.Text);
  ini1.Free;
end;

procedure TUpIpDate.FTPUserChange(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','ftpuser',ftpuser.Text);
  ini1.Free;
end;

procedure TUpIpDate.FTPPass1Change(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','FTPPass1',FTPPass1.Text);
  ini1.Free;
end;

procedure TUpIpDate.FTPPass2Change(Sender: TObject);
var
  ini1:tinifile;
begin
  ini1:=tinifile.Create(app_path1+'Operate.ini');
  ini1.WriteString('upip','FTPPass2',FTPPass2.Text);
  ini1.Free;
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -