major script problem

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
TMM
Posts: 47
Joined: 2003-01-03 19:50
Location: leeds UK
Contact:

major script problem

Post by TMM » 2003-02-27 09:49

okay some smart arse is jamming the scripts, and i dont know how it can possibley be stopped.#

the users have nm dc or whatever with no dc++ tag

but they are putting <V: 0.232> in just like that, numbers can be changed i guess, my point is.

when the script see's <V:
it does a dc++ check.....

but with no H: or S:

it crashes because there is no beforefirst and no afterlast

see what i mean.....

anyone got a simple fix i can slap in dataarrival

thanks
ashes to ashes, dust to dust, if the dope dont get you. The acid must

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-02-27 09:59

fix your beforefirst and afterlast functions to return "" when they didn't find anything, or check if they returned null or something
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

TMM
Posts: 47
Joined: 2003-01-03 19:50
Location: leeds UK
Contact:

Post by TMM » 2003-02-27 11:12

fats responce thanks

do you have an example?????

i have

Function getHubNumber(sCurData)
Dim k
k = afterFirst (sCurData,"<++ ")
k = afterFirst (k,"H:")
k = beforeFirst (k,",")
If Not (isNumeric(helpString)) then
k= -1
End If
getHubNumber = cInt(k)
End Function

as a check for slots; so i dont edit this right?????

Function BeforeFirst(sIn, sFirst)
BeforeFirst = Left(sIn, InStr(1, sIn, sFirst) - 1)
End Function

Function AfterFirst(sIn,sFirst)
AfterFirst=Right(sIn,Len(sIn)-InStr(1,sIn,sFirst)-(Len(sFirst)-1))
End Function

there is my afterfirst and before first, would apreciate an example of what could be added a working one thanks 2 hubs crashed allready
ashes to ashes, dust to dust, if the dope dont get you. The acid must

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2003-02-27 11:36

afterfirst sounds very wrong to me...
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

DamionNH
Posts: 25
Joined: 2003-01-07 11:05

Post by DamionNH » 2003-02-27 13:18

This might help.. changing the BeforeFist and such routines.

Code: Select all

Function BeforeFirst(sIn, sFirst) 'These are helper functions and do what their names imply
   If InStr(1, sIn, sFirst) Then
      BeforeFirst = Left(sIn, InStr(1, sIn, sFirst) - 1)
   Else
      BeforeFirst = ""
   End If
End Function

Function AfterFirst(sIn, sFirst)
   If InStr(1, sIn, sFirst) Then
      AfterFirst = Right(sIn, Len(sIn) - InStr(1, sIn, sFirst) - (Len(sFirst) - 1))
   Else
      AfterFirst = ""
   End If
End Function

Function AfterLast(sIn, sAfterLast)
   If InStr(1, sIn, sAfterLast) Then
      AfterLast = Right(sIn, Len(sIn) - InStrRev(sIn, sAfterLast) - (Len(sAfterLast) - 1))
   Else
      AfterLast = ""
   End If
End Function

Function BeforeLast(sIn, sBeforeLast)
    If InStr(1, sIn, sBeforeLast) Then
        BeforeLast = Left (sIn , InStrRev(sIn, sBeforeLast) - Len(sBeforeLast))
    Else
        BeforeLast = ""
    End If
End Function
Owner of Lurkers Lair a Phoenix Rising Hub

DamionNH
Posts: 25
Joined: 2003-01-07 11:05

Post by DamionNH » 2003-02-27 13:19

This might help.. changing the BeforeFist and such routines.

Code: Select all

Function BeforeFirst(sIn, sFirst) 'These are helper functions and do what their names imply
   If InStr(1, sIn, sFirst) Then
      BeforeFirst = Left(sIn, InStr(1, sIn, sFirst) - 1)
   Else
      BeforeFirst = ""
   End If
End Function

Function AfterFirst(sIn, sFirst)
   If InStr(1, sIn, sFirst) Then
      AfterFirst = Right(sIn, Len(sIn) - InStr(1, sIn, sFirst) - (Len(sFirst) - 1))
   Else
      AfterFirst = ""
   End If
End Function

Function AfterLast(sIn, sAfterLast)
   If InStr(1, sIn, sAfterLast) Then
      AfterLast = Right(sIn, Len(sIn) - InStrRev(sIn, sAfterLast) - (Len(sAfterLast) - 1))
   Else
      AfterLast = ""
   End If
End Function

Function BeforeLast(sIn, sBeforeLast)
    If InStr(1, sIn, sBeforeLast) Then
        BeforeLast = Left (sIn , InStrRev(sIn, sBeforeLast) - Len(sBeforeLast))
    Else
        BeforeLast = ""
    End If
End Function
Owner of Lurkers Lair a Phoenix Rising Hub

TMM
Posts: 47
Joined: 2003-01-03 19:50
Location: leeds UK
Contact:

Post by TMM » 2003-02-27 17:16

COOL this is why i love this fakin forum

LOLOL

mind my spanish

:))
ashes to ashes, dust to dust, if the dope dont get you. The acid must

DamionNH
Posts: 25
Joined: 2003-01-07 11:05

Post by DamionNH » 2003-02-28 10:56

Fist sorry about the double post.

Odc is using a funky tag to now.. having to adjust my bot also. I love standards.. which are never a dc thing. :D
Owner of Lurkers Lair a Phoenix Rising Hub

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-02-28 17:37

An alternative to fixing the beforefirst and afterfirst would be to start the dc++ check with a :

Code: Select all

On Error Resume Next
Then after you made all your checks, and used your unmodified afterfirst, beforefirst, etc etc -which should then have generated an error message on the way-, slap a :

Code: Select all

If Err.Number <> 0 Then [i]Call SlotsAbuse("fake","",objUser)[/i]:Exit Sub
(in my own code, SlotsAbuse is a sub that tries to determine if the user has a fixed/dynamic IP and accordingly bans either IP or the nick; temp or perm, depending on the type of abuse; PMs the user with the reason, etc etc. I'm sure you get the picture. If you don't want to call another sub, ban/kick them directly at that point of your sub)


The point is... if someone crashes the tag check, they're usualy a fake DC++ with half-modified tags because they don't know enough C++ to make something clean; so you end up with clients here and there that have a tag like : <++ V:0.181,M:A,U:312,S:1>

If you fix your beforefirst, afterfirst, etc functions so they don't generate an error message with the NMDC clients you described, you might very well end up letting the tag hiders/modifiers in your hub as well, since they won't generate error messages either.

Note : An error is always fatal in vbs, unless you use "On Error Resume Next". Technically, they weren't crashing your code, it's just that you had no error handling =)
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

smitty
Posts: 53
Joined: 2003-03-01 14:45

Post by smitty » 2003-03-08 20:29

to compensate for oDC use AfterLast instead of AfterFirst

HaArD
Posts: 147
Joined: 2003-01-04 02:20
Location: Canada http://hub-link.sf.net
Contact:

Post by HaArD » 2003-03-09 23:25

If you take ButterflySoul's suggestions just remember, once you've eliminated known client's (NMDC, DC++, oDC) what's left isn't necessarily faker/cheaters, it's unknown clients. They might be faker/cheaters but don't assume they are in your script or you'll wind up with users who think your script is a pain in the @$$.

HaArD

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-03-10 09:24

If you take ButterflySoul's suggestions just remember, once you've eliminated known client's (NMDC, DC++, oDC) what's left isn't necessarily faker/cheaters, it's unknown clients
Maybe I explained it wrong, but my suggestion was just that if someone has a "<++" in their description -and consequently enters the DC++ hub/slots check of your code- you can start the check with On Error Resume Next and finish it by checking if no Error Code was returned. If someone generates an error once they entered the hub/slots check, they are (it's 100% sure) a tag modifier.

Clients such as NMDC, oDC or any other client will never be affected by my suggestion or wrongly kicked, since they don't have "<++" in their description, and will consequently never generate an error in the hubs/slots ratio check (since they won't enter the portion of code performing said check, if your script is written properly =).
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

Locked