?
Solved

Q about .htaccess files

Posted on 2005-03-17
9
Medium Priority
?
152 Views
Last Modified: 2010-04-06
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
Comment
Question by:orik7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 
LVL 19

Expert Comment

by:Barthax
ID: 13564646
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
 

Author Comment

by:orik7
ID: 13564916
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
 
LVL 19

Expert Comment

by:Barthax
ID: 13564954
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:orik7
ID: 13565096
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
 
LVL 19

Expert Comment

by:Barthax
ID: 13565392
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
 

Author Comment

by:orik7
ID: 13569119
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
 
LVL 19

Expert Comment

by:Barthax
ID: 13569689
No problem. :)

Refund away. :)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13595845
Closed, 75 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question