I have a problem with the following code.
When a user joins and leaves after a certain period, i add (if not created yet in mysql-DB) or update his uptime in mysql-DB (if already created).
My problem is, when a person leaves (i.e. MaRkO) and he was already created as marko, then the database will create a new user in stead of updating his actual ID.
Does any one have an idea why the string tolower isn't working?
Thanks.
Buffy
Code: Select all
proc userleft {nick uhost hand dest key arg} {
set fs1 [open /home/account/eggdrop/logs/timeon.txt a+]
puts $fs1 "$arg"
close $fs1
set user [lindex [split $arg] 0]
set time [join [lrange $arg 1 end]]
mysql_connect datab localhost account passw /var/lib/mysql/mysql.sock
set listuser [mysql_query "SELECT name FROM Userinfo"]
foreach a $listuser {
lappend list1 [string tolower $a]
}
if {[lsearch -exact $list1 [string tolower $user]] == -1} {
set insert_command [mysql_query "INSERT INTO Userinfo (name) VALUES ('$user')"]
set newtime [mysql_query "UPDATE Userinfo SET timeon='$time' WHERE name='$user'"]
set time [convert_online $time]
set timesec [mysql_query "UPDATE Userinfo SET timeonsec='$time' WHERE name='$user'"]
} else {
set presenttime [mysql_query "SELECT timeon FROM Userinfo WHERE name='$user'"]
set convpresenttime [convert_online $presenttime] #the convert_online is working ok !
set convuseronline [convert_online $time]
set useronline [expr $convuseronline+$convpresenttime]
set onlinetime [duration $useronline]
set newtime [mysql_query "UPDATE Userinfo SET timeon='$onlinetime' WHERE name='$user'"]
set newtime [mysql_query "UPDATE Userinfo SET timeonsec='$useronline' WHERE name='$user'"]
}
}