mIRC Homepage

Socket Script Help

Posted By: ToRmEnTeD

Socket Script Help - 09/11/08 03:41 PM

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
}





Posted By: Lpfix5

Re: Socket Script Help - 10/11/08 03:55 AM

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
Posted By: ToRmEnTeD

Re: Socket Script Help - 10/11/08 05:17 AM

Thanks it worked perfect. I knew it wasnt gonna be much but i didnt have a clue. Thanks and sorry
Posted By: ToRmEnTeD

Re: Socket Script Help - 11/11/08 12:57 AM

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
}

Posted By: Lpfix5

Re: Socket Script Help - 11/11/08 04:16 AM

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.
Posted By: zantetsuken

Re: Socket Script Help - 12/11/08 02:58 PM

HTTP/1.1 i would use HTTP/1.0 seems to work better in my opinion. see if that helps
Posted By: ToRmEnTeD

Re: Socket Script Help - 12/11/08 06:00 PM

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?


Posted By: zantetsuken

Re: Socket Script Help - 12/11/08 11:35 PM

dunno right off.. try striping the text
Posted By: ToRmEnTeD

Re: Socket Script Help - 13/11/08 12:24 AM

Hey zan, That worked great as you know. Apprecate it bro! smile
Posted By: ToRmEnTeD

Re: Socket Script Help - 28/11/08 11:31 PM

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
© 2020 mIRC Discussion Forums