Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-21-2004, 05:12 PM   #1
Registered: Apr 2004
Distribution: Gentoo
Posts: 34

Rep: Reputation: 15
PHP List /home/'user' then finger 'user'

Well, I was asked by a teacher if I knew Php, I said no. He said basically "cool, now could you make me this script?"

I need a PHP script that hoes into the /home directory and fingers all the users in it, then outputs a list of their names as reported by finger. That in turn will link to their public_html folder inside theit home directory.

The server is running Apache 2.0 and is running on FC1.

I could use some help and possably an explanation of the code used.
Old 09-22-2004, 04:12 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
PHP Code:
// list of directories in /home as trimmed string, eg without the
// last \n
$list_string =  trim(`find /home -maxdepth 1 -type d`);

// create an array from that
$list_array explode("\n"$list_string);

// link format
$link "<a href=\"http://server/home/%s/public_html\">%s</a><br>\n";

// output finger and links
foreach($list_array as $path) {
$user str_replace("/home/"""$path);
    echo `
finger $user`."<br>";

Last edited by Cedrik; 09-22-2004 at 04:16 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
Load kde profile from /mnt/removable/user instead of /home/user Linux - General 3 12-02-2005 03:00 PM
Locking user into /home/user zaimor Linux - Security 10 11-06-2005 06:34 PM
How to lock user in /home/user herc Linux - Software 3 09-15-2003 11:50 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration