mIRC Homepage
Posted By: xrn0id why dosnt this auto-upate work? - 19/02/03 12:32 PM
alias updatecheck { sockopen VersionCheck.ftpxdcc www.mp3car.com 80 }
on *:START: {
if (%servers.version == $null) {
set %servers.version 1.6
}
if ($c.set(ftpxdcc,start) > 50) {
sockopen VersionCheck.ftpxdcc www.mp3car.com 80
}
}
on *:SOCKOPEN:VersionCheck.ftpxdcc: {
.sockwrite -n $sockname GET /usersites/bombboyer/version.txt HTTP/1.0
.sockwrite -n $sockname Host: www.mp3car.com
.sockwrite -n $sockname Accept: text/plain
.sockwrite -n $sockname User-Agent: User-Agent: ftpxdcc_update/1.0.0.5 (compatible; MSIE 6.0b; WinXP Pro ;ftpxdcc)
.sockwrite -n $sockname Pragma: no-cache
.sockwrite $sockname $crlf
}
on *:SOCKREAD:VersionCheck.ftpxdcc:{
if ($sockerr > 0) return
:nextread
.sockread %version
if ($sockbr == 0) return
var %version.info %version
tokenize 32 %version.info
if (%version.info > %servers.version) {
echo -a New Update Ready
}
if (%version.info == %servers.version) { echo -a You are running the most up-to-date version }
goto nextread
sockclose $sockname
}

the files are where they are spose to be, and everything it set, its deff a syntax error on my part. That it does is whenever i do /updatecheck i get:

New Update Ready
New Update Ready
New Update Ready
New Update Ready
New Update Ready
New Update Ready
New Update Ready

Like that. Why does it do that so many times, and how can I make the script work?
Posted By: Nobodi Re: why dosnt this auto-upate work? - 19/02/03 01:06 PM
Did you try adding an 'echo -a %version' after the sockread line to see what data the socket is recieving,
Posted By: _D3m0n_ Re: why dosnt this auto-upate work? - 19/02/03 04:45 PM
ok i had the same problem ...... but what i found out fixed it was changing the format of the txt file to something like this

<html><body>
Version: 1.0.0.5 Download_URL:
http://www.SERVERNAME.FOR.NEW.UPDATE
<END FILE></BODY></HTML>

if your interested in checking the one i made out ... PM me and ill give u the url for the code and the exact url for the file it looks up
Posted By: xrn0id Re: why dosnt this auto-upate work? - 19/02/03 05:24 PM
D3m0n, im not usind the "Download_URL:" at all, so I Took it out. I had it workign for a while, but then it broke again. Is there anyting wrong wite code? and im goign to try that guys echo idea.
Posted By: xrn0id Re: why dosnt this auto-upate work? - 19/02/03 05:36 PM
after addign the echo -a %version, I get this when i do /updatecheck:

HTTP/1.0 200 OK
New Update Ready
Server: Microsoft-IIS/5.0
New Update Ready
Date: Wed, 19 Feb 2003 17:32:37 GMT
New Update Ready
Content-Type: text/plain
New Update Ready
Accept-Ranges: bytes
New Update Ready
Last-Modified: Wed, 19 Feb 2003 02:34:39 GMT
New Update Ready
ETag: "dca27a73bfd7c21:978"
New Update Ready
Content-Length: 14
New Update Ready
X-Cache: MISS from 10.0.3.11
New Update Ready
Connection: close
New Update Ready
Version: 1.6
New Update Ready

so whats up?

my version.txt file is located at:
http://www.mp3car.com/usersites/bombboyer/version.txt
Posted By: xrn0id Re: why dosnt this auto-upate work? - 19/02/03 06:03 PM
but dont worry about it, i got a new version that works just fine:

alias updateftpxdcc sockopen ftpxdccUpdate www.mp3car.com 80
on *:SOCKOPEN:ftpxdccUpdate:{
sockwrite -n $sockname GET /usersites/bombboyer/version.txt HTTP/1.1
sockwrite -n $sockname Host: www.mp3car.com
sockwrite -n $sockname Accept: text/plain
sockwrite -n $sockname Pragma: no-cache
sockwrite $sockname $crlf
set -u300 %ftpxdccUpdate.Body $false
}
on *:SOCKREAD:ftpxdccUpdate:{
if ($sockerr) {
echo -a Update Error, try again later.
}
var %text
while (1) {
sockread %text
if (!$sockbr) return
if (!%text) set -u300 %ftpxdccUpdate.Body $true
if (%ftpxdccUpdate.Body) && (%text) {
set %Script.Current.Version $gettok(%text, 2, 32)
if (%Script.Current.Version > %servers.version) {
echo -a New Sript Rready
}
if (%Script.Current.Version == %servers.version) {
echo -a You Are Up To Date
}
if (%servers.version == $null) {
echo -a You need to set a version
}

sockclose $sockname
unset %ftpxdccUpdate.Body
unset %Script.Current.Version
halt
}
}
}
© mIRC Discussion Forums