MySQL Human Verification 1.00 STABLE (MBC Base)

By Noutrious on Oct 04, 2011

This is a module for MySQL Bot Core system.
You'll need http://www.hawkee.com/snippet/8882/ in case for this to work.

PHP Side: http://www.hawkee.com/scripts/20788797/

[14:59] -##SQL- To verify yourself and gain +v (ability to talk), please visit http://127.0.0.1/verify/

; MySQL Bot Core
; Module: Human Verification
; Version: 1.00 STABLE
; Author: Nils Putnins (Neisen@Neisen.lv)

; - aliases
alias -l m.hver.cfg {
  if ($1 == channel) return #yourchan
  else if ($1 == url) return http://url.to.php.script/
}
alias -l m.hver {
  if ($prop == sync) {
    var %chan = $m.hver.cfg(channel)
    if ($me isop %chan) || ($me ishop %chan) {
      if (m !isincs $chan(%chan).mode) mode %chan +m
      var %sql = SELECT * FROM `captcha`, %chan = $m.hver.cfg(channel)
      var %data = $mysql_query(%m.sql, %sql)
      while ($mysql_fetch_row(%data, captcha)) $iif($ial($+(*@,$hget(captcha, address))).nick,mode %chan +v $v1)
      mysql_free %data
    }    
    var %sql = DELETE FROM `captcha` WHERE `time` < (NOW() - INTERVAL 30 SECONDS)
    noop $mysql_query(%m.sql, %sql)
  }
  else if ($prop == key) return $m.dbres(address,captcha,key,$1)
}

; - actions
on *:JOIN:#:if ($chan == $m.hver.cfg(channel)) notice $nick To verify yourself and gain +v (ability to talk), please visit $bold($uline($m.hver.cfg(url)))
on *:TEXT:*:?:{
  if ($1-2 == verify me) && ($len($3) == 3) {
    if ($m.hver($3).key) {
      var %address = $v1
      $iif($me isop $m.hver.cfg(channel),mode $v2 +v $nick)
      var %sql = DELETE FROM `captcha` WHERE `address` = ?
      noop $mysql_query(%m.sql, %sql, %address)
      msg $nick Thank you, you're now verified.
    }
    else msg $nick Sorry, I don't recognize such key. Maybe it's expired?
  }
}

; - communicating with core
on *:SIGNAL:m.modules:{
  m.modules $+(Human Verification,$chr(124),$chr(124),0)
  noop $m.hver().sync
}

Comments

Sign in to comment.
Greedi   -  May 23, 2012

No sql struktur help?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.