This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

getuser $handle LASTON - "issue"

Old posts that have not been replied to for several years.
Locked
t
taliesen
Voice
Posts: 10
Joined: Mon Jan 26, 2004 1:51 pm

getuser $handle LASTON - "issue"

Post by taliesen »

ok, have a lil script that will write out the users in the userlist that havnt been seen in X ammount of days, this uses the ..

Code: Select all

set lastseen [lindex [getuser $hand LASTON] 0]
$hand would of course be their handle.

now this works fine in the if statement to check against the unixtime - how ever long a period. BUT when i try to output this to the file that lists the old users, it just does a blank space, nothing else.

now i have also tried just a full [getuser $hand LASTON] with out the lindex, and same results, nothing.

even tested to see if there was some weird thing with the puts line, so i used....

Code: Select all

putlog "$lastseen"
just to test this, same result, a bunch of space.

any ideas why i can use this info in an if statement, but if i try to output the same info i get null?

TalieseN
t
taliesen
Voice
Posts: 10
Joined: Mon Jan 26, 2004 1:51 pm

Post by taliesen »

here is the entire code, this is orignially a script called cleanup.tcl by Christian Felde and i just modified it to output names to a html file, instead of deleting them.

Code: Select all

##bind time - "00 04 * * *" time_scan_userfile
bind dcc +m cleanup dcc_scan_userfile

proc dcc_scan_userfile {hand idx args} {
    putlog "$hand started userfile scan... Time: [time]"
    scan_userfile
}

proc time_scan_userfile {min hour day month year} {
    putlog "Stated auto-scan of userfile. Time: [time]"
    scan_userfile
}

proc scan_userfile { } {
    set rmusers 0
    set errors 0
    set file "/home/taliesen/public_html/oldusers.html"
    set fs [open $file w]
    puts $fs "<html><body><table><tr><td>NickName</td><td>Last Time Seen</td></tr>"
    close $fs 
    foreach hand [userlist] {
   	
	set leave 0
      set lastseen [lindex [getuser $hand LASTON] 0] 
	if {$lastseen < [expr [unixtime] - 5184000]} {
	    if {[matchattr $hand +n] == 1} {
		set leave 1
	    }
	    if {[matchattr $hand +m] == 1} {
		set leave 1
	    }
	    if {[matchattr $hand +f] == 1} {
		set leave 1
	    }
	    if {[matchattr $hand +o] == 1} {
		set leave 1
	    }
	    if {$leave == 0} {
		putlog "$lastseen"
		set fs [open $file a]
		puts $fs "<tr><td> $hand </td>"
		puts $fs "<td> $lastseen </td></tr>" 
		close $fs 
	    }
	}
    }
    putlog "CleanUp stats:"
    putlog "Current time: [time]"
    putlog "Users deleted: $rmusers"
    putlog "Errors: $errors"
    set fs [open $file a]
    puts $fs "</table></body></html>"
    close $fs 
}

putlog "cleanup.tcl loaded..."
putlog "Made by Christian Felde"
putlog "email: cfelde@powertech.no or cfelde@geocities.com"
Locked