#!/usr/local/bin/perl #Show all users in table in the Following format: #Username | EnabledIcons | | #On the Button put Button Change Global Settings print "content-type: text/html iDesk Webmin Module "; #Read File /etc/passwd open (PASSWDFILE, "//etc//passwd"); while ($record = ) { #Filter out everyone from UID 1000 of Bigger #Thats the 3th Collum and set %HOMEDIR% to the 6th Collum $FirstCollumEnds = index($record,":",0) + 1; $SecondCollumEnds = index($record,":",$FirstCollumEnds) +1; $ThirthCollumEnds = index($record,":",$SecondCollumEnds)+1; $FourthCollumEnds = index($record,":",$ThirthCollumEnds)+1; $FifthCollumEnds = index($record,":",$FourthCollumEnds)+1; $SixthCollumEnds = index($record,":",$FifthCollumEnds) +1; #THIRT COLLUM IS 1000 OR HIGHER #ATTENTION NEEDED: #Changed to 0 for Debug Reasons. #Change it back to 1000 when working.. #if(substr($record, $SecondCollumEnds, ($ThirthCollumEnds-$SecondCollumEnds))ge 0) #ge is: >= #{ #Set %Username% to First Collum Value $Username = substr($record, 0, $SecondCollumEnds-3); #Dont ask the -3. Dont know why, but it seems to work.. ^^ print ""; #Read "ls %HOMEDIR%/.idesktop" $homedir = substr($record, $FifthCollumEnds, $SixthCollumEnds-1); #$output = ls("$homedir//.idesktop"); #print ""; print""; #DEBUG ONLY print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; #DEBUG ONLY END #Read if iDesk files and directorys exist: #File %HOMEDIR%/.ideskrc and dir %HOMEDIR%/.idesktop ##ATTENTION NEEDED: #if(($homedir/.idesktop/)&& ($homedir/.ideskrc)) #{print "";} else {print "";} #Check if iDesk is running by Person. ##ATTENTION NEEDED: #And put the edit button down. ##ATTENTION NEEDED: #print " print""; #}else{print"";} }#Check for another. close(PASSWDFILE); #When everything is found do: ##ATTENTION NEEDED: #print " # print""; #### $homedir = substr($record, $FifthCollumEnds, $SixthCollumEnds-1); #$output = ls("$homedir//.idesktop"); #print ""; print"";
UsernameEnabled IconsStatusRunningEdit
$Username $output $homedirDB:::R: $recordA: ($SixthCollemEnd+1)-$FifthCollumEndsF: $FirstCollumEnds S: $SecondCollumEnds T: $ThirthCollumEnds F: $FourthCollumEnds 5: $FifthCollumEnds S: $SixthCollumEnds FOUND Not Found
No Users found. - FAILED FAILED -
$output $homedir