• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Q about .htaccess files

hello.
I have to directory "albums" protected with .htaccess.
In it i have the file "hello.php" which contain just echoing "hello, UserName."
file hello.php is in an <iframe> on faremed page.

i would like the if the login is success the <iframe> will go to "hello.php's" URL so the user name will be displayed.
So how do i find out if it is a success login or not and is there a function on .htaccess that can send my iframe to another url?

thanx alot. ori.
0
orik7
Asked:
orik7
  • 4
  • 3
1 Solution
 
BarthaxCommented:
In your .htaccess, you can override (if the main http.conf allows) the DirectoryIndex such that it defaults to hello.php:

DirectoryIndex hello.php

You can have a seperate statement which overrides the 403 error for that directory also:

ErrorDocument 403 hello403.php

Then you code the hello403.php to do what you need.

HTH
0
 
orik7Author Commented:
thanx for replying,
I'm using now:
ErrorDocument 401 /errors/hello.html
hello.html is outside the protected dir' (and is in the <iframe>) and contian a login link to hello.php (protected). so it will show the username but only if user click the link.
but if user is trying to access a different (protected) file and login to that - then comes my previous question...

I was trying to add :DirectoryIndex hello.php but did not see any effect..
here how my file looks like:
--------
ErrorDocument 401 /errors/401.html
AuthType Basic
AuthName "Login in order to Access all Photos"
AuthUserFile "/.htpasswds/main/register/albums/.htpasswd"
Order deny,allow
require valid-user

<FilesMatch "hello.php">
ErrorDocument 401 /errors/hello.html
</FilesMatch>
--------
ori.
0
 
BarthaxCommented:
Minor update... the ErrorDocument will need to point to a path that is not the local path as the user doesn't have access to it!

ErrorDocument 403 /errors/forbidden.php
ErrorDocument 401 /errors/authenticationrequired.php
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
orik7Author Commented:
yes, ofcourse.
errorDocument - hello.html  is outside the protected erea. but is containing a (login) link to hello.php at the protected erea.
but thanx (have done that mistake already :).
is there any way for .htaccess file resulting something on success login (as it have on failier with ErrorDocument)?
ori.
0
 
BarthaxCommented:
Hehe, I had started typing my second response before yours, hence the overlap. :(

Apache looks to the DirectoryIndex declaration when a user does not specify a particular page - this happens whether the user has to login or not.  The DirectoryIndex command won't work unless you have an AllowOverride Indexes in the httpd.conf file.
0
 
orik7Author Commented:
Barthax, thanx alot for your replys.
the answer was in JS - I used onLoad="window.parent.myframe.myIframe.location.href='hello.php';" on all the files that are in the protected area.
So if it is success login the file is accessed loads...
Thanx again and i hope we'll meet again.
ori.
p.s. i'm sure you could help more if i'd given a link but it a privete album and didn't want to have the link on EE for google to find. perheps next time i'm posting a Q i'll email a link :)
0
 
BarthaxCommented:
No problem. :)

Refund away. :)
0
 
moduloCommented:
Closed, 75 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now