View difference between Paste ID: cnLebRPr and sd7xFbMN
SHOW: | | - or go back to the newest paste.
1
alias details { return  }
2
on *:INPUT:*: {
3-
  if (!%database) { %database = mirc }
3+
4
  if ($1 == ~createtable) && ($2) {
5
    var %info_db = $mysql_connect($readini(db.info.ini, info, host), $readini(db.info.ini, info, user), $readini(db.info.ini, info, pass))
6
    if (%info_db) {
7
      var %sql = CREATE TABLE $2-
8
      var %stmt = $mysql_exec(%info.db, %sql)
9
      if (!%stmt) {
10
        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))
11
      }
12
      else {
13
        mysql_exec %info.db %stmt
14
      }
15
    }
16
  }
17
18
  if ($1 == ~insert) && ($2) {
19
    %insertdata = $3-
20
    var %x = 1
21
    %testvar = $numtok(%insertdata,32)
22
    while (%x <= %testvar) {
23
      set %testvar_result $instok(%testvar_result,$mysql_qt($gettok(%insertdata,%x,32)),0,44)
24
      inc %x
25
    }
26
    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))
27
    if (%info.db) {
28
      %sql = INSERT INTO $2 VALUES ( %testvar_result );
29
      var %stmt = $mysql_exec(%info.db, %sql)
30
      unset %testvar* %insertdata
31
      if (!%stmt) {
32
        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))
33
      }
34
      else {
35
        mysql_exec %info.db %stmt
36
      }
37
38
    }
39
  }
40
41
}