It takes the data from a line of text, selects the data in a mysql query.
That works fine, but what i would like is, if the data exists in the database, the data is not added again.
I have tried many things but it fails
any suggestions please ?
Code: Select all
proc check123 { nick host hand chan text} {
set text [split $text]
set nickname [lindex $text 1]
scan [string trim [lindex $text 2] {(),}] {%[^@]@%s} ident isp
set ip [string trim [lindex $text 4] {[]}]
putquick " PRIVMSG #security NickName:\00304$nickname \00301Ident:\00304$ident \00301ISP:\00304$isp \00301User IP:\00304$ip"
set result [mysql_query "SELECT nickname , ident , isp , ip FROM checklist where ip = '$ip' limit 6"]
putquick "PRIVMSG #security :Matches For the IP (Please Note Some IPS are Dynamic) :"
foreach item $result {
putquick "PRIVMSG #security :Record: [join $item ", "]"
}
mysql_query "INSERT INTO `checklist` ( nickname , ident , isp , ip ) VALUES ( '[mysql_escape $nickname]' , '[mysql_escape $ident]' , '[mysql_escape $isp]' , '[mysql_escape $ip]')"
}