[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] user and password files!!



Hello Steve,

> >$this_server = %ENV{HTTP_HOST};
> 
> This would show the domain name they are entering from would it not??

Yes, it would. I misunderstood what you wanted ;-)

Try the following behind your .htaccess file. It's a bit of a hack, but
produces the results on the Cobalt RaQs:

#!/usr/bin/perl
opendir (DIR, "/home/sites");
while ($file = readdir (DIR)) {
	$link = readlink ("/home/sites/$file");
	if ($link) {
		@levels = split (/\//,$link);
		$domains{$levels[-1]} = $file;
	}
}
closedir (DIR);
$user = $ENV{REMOTE_USER};
$shell = (getpwnam $user)[7];
if ($shell =~ /site\d+/) {$site = $&;} else {$site = "home";}
print "content-type: text/html\n\n";
print " User:[$user] Domain:[$domains{$site}]\n";
exit;

Regards,
Jonathan Michaelson

Way to the Web Ltd
Commercial CGI Scripting, Web Hosting
http://www.waytotheweb.com