Advertisement
Xzempt

Untitled

Feb 2nd, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.49 KB | None | 0 0
  1. alias details { return  }
  2. on *:INPUT:*: {
  3.   if (!%database) { %database = mirc }
  4.   if ($regex(sql,$1,/(/|/{2})/)) { return }
  5.   if ($1 == ~createtable) && ($2) {
  6.     var %info_db = $mysql_connect($readini(db.info.ini, info, host), $readini(db.info.ini, info, user), $readini(db.info.ini, info, pass))
  7.     if (%info_db) {
  8.       var %sql = CREATE TABLE $2-
  9.       var %stmt = $mysql_exec(%info.db, %sql)
  10.       if (!%stmt) {
  11.         echo -a $str($chr(160),25) $+(7Error Message:12 %mysql_errstr,$chr(32),07,$chr(40),$chr(32),09Error:,$chr(32),%mysql_errno,$chr(32),07,$chr(41))
  12.       }
  13.       else {
  14.         mysql_exec %info.db %stmt
  15.       }
  16.     }
  17.   }
  18.  
  19.   if ($1 == ~insert) && ($2) {
  20.     %insertdata = $3-
  21.     var %x = 1
  22.     %testvar = $numtok(%insertdata,32)
  23.     while (%x <= %testvar) {
  24.       set %testvar_result $instok(%testvar_result,$mysql_qt($gettok(%insertdata,%x,32)),0,44)
  25.       inc %x
  26.     }
  27.     var %info.db = $mysql_connect($readini(db.info.ini, info, host), $readini(db.info.ini, info, user), $readini(db.info.ini, info, pass), $readini(db.info.ini, info, db))
  28.     if (%info.db) {
  29.       %sql = INSERT INTO $2 VALUES ( %testvar_result );
  30.       var %stmt = $mysql_exec(%info.db, %sql)
  31.       unset %testvar* %insertdata
  32.       if (!%stmt) {
  33.         echo -a $str($chr(160),25) $+(7Error Message:12 %mysql_errstr,$chr(32),07,$chr(40),$chr(32),09Error:,$chr(32),%mysql_errno,$chr(32),07,$chr(41))
  34.       }
  35.       else {
  36.         mysql_exec %info.db %stmt
  37.       }
  38.  
  39.     }
  40.   }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement