
rGeoffrey
User
/ Moderator
Oct 12, 2001, 2:32 PM
Post #4 of 4
(301 views)
|
|
Re: full path and virtual path
[In reply to]
|
Can't Post
|
|
This is closer to what you want...
my %ENV = (HTTP_REFERER => 'http://www.vaip.werro.ee/elvar/katsed/', SERVER_NAME => 'www.vaip.werro.ee', ); $ENV{HTTP_REFERER} =~ m|$ENV{SERVER_NAME}/(.*)|; my @parts = split ('/', $1); my $user = shift @parts; my $file = join ('/', "/home/$user/public_html", @parts); print $ENV{HTTP_REFERER}, "\n"; print $file, "\n"; And in answer to your other question, you need to make sure that "home/$user" exists...
print "the file does exist\n" if (-e $file); There are a great many other file checks like -d for directory that might also be useful.
|