mIRC Home    About    Download    Register    News    Help

Print Thread
#13738 02/03/03 03:50 AM
Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
hi guys/gals/things....

i have a program called mircstats that takes the logs of a channel and converts them to html and does a whole bunch of stuff to them. but if always includes the date of the logs in the filename, and, well, i need the filename to be the same all the time. So I need a script (if possible) to open an ftp connection to the webspace that contains the finished html file, rename it from #channel.20030301.html to channel.html. Is there such a script that can do this, prefereably without dll's but dll's might be ok, if documentation is included . smile

i hope i made this all clear. smile



keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
#13739 02/03/03 03:56 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This tutorial can give you some ideas.

#13740 02/03/03 10:36 AM
Joined: Dec 2002
Posts: 580
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580


NaquadaBomb
www.mirc-dll.com
#13741 02/03/03 09:11 PM
Joined: Dec 2002
Posts: 580
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
Try this it, it should do what you want using PORT rather than PASV transfers

Code:
; set these somewhere...
;  %FTP.LocalFile, %FTP.RemoteFile (Use full paths for both)
;  %FTP.Site, %FTP.Port, %FTP.Login, %FTP.Pass 
;----------------------------
; use /sendit to send the file
alias sendit { sockopen ftpupload %FTP.Site %FTP.Port }
alias ftpcmd { sockwrite -n ftpupload $1- }
alias port8bit { var %P | if ($1 isnum) { set %P $base($1, 10, 2) | 
  return $base($left(%P, -8), 2, 10) $+ , $+ $base($right(%P, 8), 2, 10) } | return $null }
alias openport { var %Port | set %Port $rand(1024, 32000) | while ($freeport(%Port) == $false) { 
  set %Port $rand(1024, 32000) } | return %Port }
on 1:sockopen:ftpupload:{ if ($sockerr > 0) return | .timer 1 1 ftpcmd user %FTP.Login }
on 1:sockread:ftpupload:{
  if ($sockerr > 0) return
  sockread -f %data | if (!%data) { return } | tokenize 32 %data
  :loop
  if ($1 == 331) { ftpcmd pass %FTP.Pass }
  if ($1 == 230) && (%FTP.No230 == $null) { ftpcmd cwd $nofile(%FTP.RemoteFile) | set %FTP.No230 $true }
  if ($1 == 250) && (%FTP.No230 != $null) {
    unset %FTP.No230 | set %FTP.dataport $openport
    socklisten ftpport.listen %FTP.dataport
    ftpcmd port $replace($ip, ., $chr(44)) $+ , $+ $port8bit(%FTP.dataport)
  }
  ; Responce from port command
  if ($1 == 200) { ftpcmd stor $nopath(%FTP.RemoteFile) }
  sockread -f %data | if (%data) { tokenize 32 %data | goto loop }
}
on 1:socklisten:ftpport.listen:{ if ($sockerr > 0) return | sockaccept ftp.dataport | ftp.sendfile }
alias ftp.sendfile {
  var %Pos 0 | var %Size 8192
  :loop
  bread %FTP.LocalFile %Pos %Size &line
  sockwrite ftp.dataport &line
  set %Pos $calc(%Pos + %Size)
  if ($file(%FTP.LocalFile).size > %Pos) { goto loop }

  ; Cleanup
  unset %FTP.dataport
  set %FTP.PostUpload $true
  sockclose ftp.dataport | sockclose ftpport.listen | sockclose ftpupload
  echo -a FTPUpload: Operation completed.
}


Edit: reformatted slightly to show better in the forum.

Last edited by Hammer; 02/03/03 09:57 PM.

NaquadaBomb
www.mirc-dll.com

Link Copied to Clipboard