lesson1_NML.zip
Assignments iau
Create a text file with the following content. It is actually a passwd
file from my Linux. It has 7 columns separated by :
The columns name are
"User","Pwd","UID","GID","Comment","Home Directory","Default Program"
Write a program utilizing the Table class to print this table.
We do NOT want lines where UID < 10
or GID < 10. Print the printing date after the table.
It must be presented in the format yyyy-mm-dd. An additional condition:
If requested by an Internet Explorer, the page background must be
yellow, if any other browser, it must be light blue.
Programming hints:
Read one line at a time
in a while loop. Use explode()
to extract fields from each line.
Example 5.6. Sample Text File
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/bin/false daemon:x:2:2:daemon:/sbin:/bin/false adm:x:3:4:adm:/var/adm:/bin/false lp:x:4:7:lp:/var/spool/lpd:/bin/false sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/bin/false news:x:9:13:news:/usr/lib/news:/bin/false uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false operator:x:11:0:operator:/root:/bin/bash man:x:13:15:man:/usr/share/man:/bin/false postmaster:x:14:12:postmaster:/var/spool/mail:/bin/false smmsp:x:209:209:smmsp:/var/spool/mqueue:/bin/false portage:x:250:250:portage:/var/tmp/portage:/bin/false nobody:x:65534:65534:nobody:/:/bin/false sshd:x:22:22:added by portage for openssh:/var/empty:/sbin/nologin cron:x:16:16:added by portage for cronbase:/var/spool/cron:/sbin/nologin xonefivd:x:1000:100:Niels Muller Larsen,A2.21,72286317,20405740:/home/xonefivd:/bin/bash messagebus:x:101:409:added by portage for dbus:/dev/null:/sbin/nologin haldaemon:x:102:410:added by portage for hal:/dev/null:/sbin/nologin ntp:x:123:123:added by portage for ntp:/dev/null:/sbin/nologin firebird:x:450:450:added by portage for firebird:/usr/lib/firebird:/bin/bash mysql:x:60:60:added by portage for mysql:/dev/null:/sbin/nologin apache:x:81:81:added by portage for apache:/var/www:/sbin/nologin postgres:x:70:70:added by portage for postgresql-server:/var/lib/postgresql:/bin/bash nml:x:1001:101::/home/nml:/bin/bash hsqldb:x:103:999:added by portage for hsqldb:/dev/null:/bin/sh tomcat:x:265:265:added by portage for tomcat:/dev/null:/sbin/nologin clamav:x:104:998:added by portage for clamav:/dev/null:/sbin/nologin usbmux:x:105:85:added by portage for usbmuxd:/dev/null:/sbin/nologin