mIRC Home    About    Download    Register    News    Help

Print Thread
Socket Script Help #206196 09/11/08 03:41 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
I am sorry to keep reposting this but it sucks it no longer works. I changed my site from a flat file database to mysql database and this script quit working along the way. It still works but the search part is usless..it just gives the same results..the first few videos on the site...If anyone can help me please i am begging frown It makes my site better
My site is www.TORMENTED.TV
Its a music video site not to far from the likes of a youtube or something...Just better laugh
Code:
 


on *:text:!tsearch*:#:tsearch $nick $2-
alias -l tsearch {
  set %tsearchnick $1
  set %tsearchstring $replace($$2-,$chr(32),+)
  sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
  if ($sockerr) { 
    echo 4  -- Socket Error! --
    return
  }
  var %s = sockwrite -n $sockname
  %s GET $+(http://www.tormented.tv/search.php?query=,%tsearchstring,&x=0&y=0&search=1) HTTP/1.1
  %s Referer: tSearch-mIRC-script(User: $+ $me $+ )
  %s Host: tormented.tv
  %s Content-Type: application/x-www-form-urlencoded
  %s Connection: Keep-Alive
  %s Cache-Control: no-cache
  %s
}
on 1:sockread:tsearch:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  if *<b>* - Not Found</b></div>* iswm %temp {
    notice %tsearchnick 04 $nohtml(%temp)
    sockclose tsearch
unset %tsearch*
  }
  elseif <a href='video.php? isin %temp {
    notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
  }
  elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
    notice %tsearchnick 03 More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
  }
  elseif %temp { noop }
  else {
    sockclose tsearch
    unset %tsearch*
  }
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9))
  return %x
}






Last edited by ToRmEnTeD; 09/11/08 04:11 PM.

Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Re: Socket Script Help [Re: ToRmEnTeD] #206246 10/11/08 03:55 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
A) Work on your code
B) Think logically how the script might not work after doing such a change.

purposely removed http:// etc... you are already calling HOST in the event... but the actual error relied on just simply on 7 characters in the search string :P

Code:
  %s GET $+(/search.php?search=,%tsearchstring,&srch=1) HTTP/1.1


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Socket Script Help [Re: Lpfix5] #206251 10/11/08 05:17 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Thanks it worked perfect. I knew it wasnt gonna be much but i didnt have a clue. Thanks and sorry


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Re: Socket Script Help [Re: ToRmEnTeD] #206279 11/11/08 12:57 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Ok this sounds dumb but after it worked for a day now it dont work anymore...says no results for everything. I am trying to study the code to try and fix it myself but i see nothing. Why would it work and then not work? The site is working fine


Code:
 



on *:text:!tsearch*:#:tsearch $nick $2-
alias -l tsearch {
  set %tsearchnick $1
  set %tsearchstring $replace($$2-,$chr(32),+)
  sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
  if ($sockerr) { 
    echo 4  -- Socket Error! --
    return
  }
  var %s = sockwrite -n $sockname
  %s GET $+(/search.php?search=,%tsearchstring,&srch=1) HTTP/1.1
  %s Referer: tSearch-mIRC-script(User: $+ $me $+ )
  %s Host: tormented.tv
  %s Content-Type: application/x-www-form-urlencoded
  %s Connection: Keep-Alive
  %s Cache-Control: no-cache
  %s
}
on 1:sockread:tsearch:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  if *<b>* - Not Found</b></div>* iswm %temp {
    notice %tsearchnick 04 $nohtml(%temp)
    sockclose tsearch
    unset %tsearch*
  }
  elseif <a href='video.php? isin %temp {
    notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
  }
  elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
    notice %tsearchnick 03 More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
  }
  elseif %temp { noop }
  else {
    sockclose tsearch
    unset %tsearch*
  }
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9))
  return %x
}



Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Re: Socket Script Help [Re: ToRmEnTeD] #206282 11/11/08 04:16 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
There's no reason for it to "not" work. Although the code can be lessen greatly it will work, just make sure your not overlapping scripts (AKA make sure you don't have 2 the same) Also make sure every bracket is account for.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Socket Script Help [Re: Lpfix5] #206319 12/11/08 02:58 PM
Joined: Apr 2008
Posts: 43
Z
zantetsuken Offline
Ameglian cow
Offline
Ameglian cow
Z
Joined: Apr 2008
Posts: 43
HTTP/1.1 i would use HTTP/1.0 seems to work better in my opinion. see if that helps

Re: Socket Script Help [Re: zantetsuken] #206320 12/11/08 06:00 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
frown Nope . See my problem is kinda weird. Alot well almost all my users use a flash/web based irc search client. Well...When this code was first givin to me it worked on the flash chats...But now the search works fine if the user is using mIRC client connected to our channel... when a user on mIRC does a command say .

" !tsearch Kazy "

In mIRC we see a result like.

[12:44:20] -From ToRmEnTeD- Kazy - Choke (http://www.tormented.tv/video.php?id=962&p=1)


And thats working perfect. However. If the same command is used on the flash chat they get a msg saying.


Guest4779: !tsearch kazy
[NOTICE] zZiDeAZz: "kazy" - Not Found

It dont matter what you search for. It finds nothing.
anyone of you may feel free to test it by going to

http://www.tormented.tv/html/chat.php


...I know this worked before and its obvious that the command is being sent and received...Just why isnt it returning any results?




Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Re: Socket Script Help [Re: ToRmEnTeD] #206333 12/11/08 11:35 PM
Joined: Apr 2008
Posts: 43
Z
zantetsuken Offline
Ameglian cow
Offline
Ameglian cow
Z
Joined: Apr 2008
Posts: 43
dunno right off.. try striping the text

Re: Socket Script Help [Re: zantetsuken] #206335 13/11/08 12:24 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Hey zan, That worked great as you know. Apprecate it bro! smile


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Re: Socket Script Help [Re: ToRmEnTeD] #206922 28/11/08 11:31 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Ok now the server my channel is located on has changed the flood settings and this script is returning too many lines and causes the bot using it to get a excess flood kick from the server


Code:

on *:text:!tsearch*:#:tsearch $nick $strip($2-)
alias -l tsearch {
  set %tsearchnick $1
  set %tsearchstring $replace($$2-,$chr(32),+)
  sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
  if ($sockerr) { 
    echo 4  -- Socket Error! --
    return
  }
  var %s = sockwrite -n $sockname
  %s GET $+(/search.php?search=,%tsearchstring,&srch=1) HTTP/1.1
  %s Referer: tSearch-mIRC-script(User: $+ $me $+ )
  %s Host: tormented.tv
  %s Content-Type: application/x-www-form-urlencoded
  %s Connection: Keep-Alive
  %s Cache-Control: no-cache
  %s
}
on 1:sockread:tsearch:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  if *<b>* - Not Found</b></div>* iswm %temp {
    notice %tsearchnick 04 $nohtml(%temp)
    sockclose tsearch
    unset %tsearch*
  }
  elseif <a href='video.php? isin %temp {
    notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
  }
  elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
  notice %tsearchnick 03 Still want more ? Visit >  12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203   }
  elseif %temp { noop }
  else {
    sockclose tsearch
    unset %tsearch*
  }
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9))
  return %x
}


 



This is my code as its working now. I think that if i could get it to limit 2 results and then the link to get more....I think that would work. I have looked at the script and sure cant find an obvious edit for this. ...If anyone gets a moment to take a look i would apprecate it

Last edited by ToRmEnTeD; 28/11/08 11:32 PM.

Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>