htaccess Help

General discussion (space-sim gaming, astronomy, and sci-fi entertainment in general, etc.).
User avatar
SeeJay
Captain
Captain
Posts: 3507
Joined: Wed Aug 11, 2010 9:03 am
Location: Sweden

htaccess Help

Post by SeeJay »

I'm working on a project where I have a part of my site protected by htaccess.

That works fine with Username/Password.

My problem is that I need to direct to different pages depending on the password used.
(Same Username but different passwords for different pages).

Is there anyone out there amongst you that knows if this can be done, and if so, how?

Thanks for any help.
I've been googling but haven't found any useful tips yet.
\"Nothing is impossible, it only takes a bit longer!\"
\"We are not retreating, we are advancing in another direction!\"


http://evochron.junholt.se (Old)
http://www.evochron2.junholt.se (New)
http://mercenary.junholt.se (Map)
http://www.junholt.se/evoschool/index.htm (No spoilers)
-8- Bzzzzzzzzz! -8- -8-
Image
zex
Lieutenant
Lieutenant
Posts: 183
Joined: Mon Dec 17, 2012 10:02 am

htaccess Help

Post by zex »

If you are using php, you can use the $_SERVER['REMOTE USER'] variable and redirect based on that..

(edit: that variable will contain the username of someone who has successfully logged in based on your htaccess/htpasswd files)

[Edited on 1-4-2013 by zex]
User avatar
SeeJay
Captain
Captain
Posts: 3507
Joined: Wed Aug 11, 2010 9:03 am
Location: Sweden

htaccess Help

Post by SeeJay »

Thanks Nex, but I haven't tried php yet.

Hoped that I wouldn't need to learn a new
language but I might have to do just that.

How hard could it be LOL.
\"Nothing is impossible, it only takes a bit longer!\"
\"We are not retreating, we are advancing in another direction!\"


http://evochron.junholt.se (Old)
http://www.evochron2.junholt.se (New)
http://mercenary.junholt.se (Map)
http://www.junholt.se/evoschool/index.htm (No spoilers)
-8- Bzzzzzzzzz! -8- -8-
Image
zex
Lieutenant
Lieutenant
Posts: 183
Joined: Mon Dec 17, 2012 10:02 am

htaccess Help

Post by zex »

I don't know of a way to serve content based on which user/pass you enter without using some sort of scripting language or cgi... at least not with the webserver softwares I'm familiar with.
User avatar
SeeJay
Captain
Captain
Posts: 3507
Joined: Wed Aug 11, 2010 9:03 am
Location: Sweden

htaccess Help

Post by SeeJay »

Ok Nex, thanks. Back to the books and try
to learn this old fart something new.

Apprecite your input mate.
\"Nothing is impossible, it only takes a bit longer!\"
\"We are not retreating, we are advancing in another direction!\"


http://evochron.junholt.se (Old)
http://www.evochron2.junholt.se (New)
http://mercenary.junholt.se (Map)
http://www.junholt.se/evoschool/index.htm (No spoilers)
-8- Bzzzzzzzzz! -8- -8-
Image
User avatar
Marvin
Global Moderator
Global Moderator
Posts: 14373
Joined: Wed Mar 04, 2009 5:47 am
Location: Fallon-Reno

htaccess Help

Post by Marvin »

:o So, SeeJay ... you're saying your website will only accept one password? Period?
User avatar
SeeJay
Captain
Captain
Posts: 3507
Joined: Wed Aug 11, 2010 9:03 am
Location: Sweden

htaccess Help

Post by SeeJay »

From post: 154468, Topic: tid=10307, author=Marvin wrote::o So, SeeJay ... you're saying your website will only accept one password? Period?
No, not at all, but it would be much easier this way.

I'll set it up in another way, so no problems really.
\"Nothing is impossible, it only takes a bit longer!\"
\"We are not retreating, we are advancing in another direction!\"


http://evochron.junholt.se (Old)
http://www.evochron2.junholt.se (New)
http://mercenary.junholt.se (Map)
http://www.junholt.se/evoschool/index.htm (No spoilers)
-8- Bzzzzzzzzz! -8- -8-
Image
Zach
Lieutenant Jr. Grade
Lieutenant Jr. Grade
Posts: 80
Joined: Mon Mar 17, 2008 12:46 am

htaccess Help

Post by Zach »

From post: 154429, Topic: tid=10307, author=zex wrote:I don't know of a way to serve content based on which user/pass you enter without using some sort of scripting language or cgi... at least not with the webserver softwares I'm familiar with.

This.

You either need to set up a content management system like Wordpress (fairly easy), and set up user groups based permissions on "published" information.

Or you need to use a multiple directory structure for your site, which you will have to manually manage yourself.

Remember, on Apache directives through HTACCESS are applied in a cascade fashion, and filter down through all directories and subdirectories.


So..

/Protected/.htacess (with Apache settings required for .htpasswrd_
/Protected/user1/.htpasswrd
/Protected/user2/.htpasswrd

etc

The down side is you would have to manually decide which pages of information they get copies of, etc.. and depending on how your project is managed internally, this could be a nightmare.

You could mitigate that problem by organizing your team into priviledged access levels, and filtering content by those access levels, instead of tailoring to each specific user.

[Edited on 2-5-2013 by Zach]
User avatar
SeeJay
Captain
Captain
Posts: 3507
Joined: Wed Aug 11, 2010 9:03 am
Location: Sweden

htaccess Help

Post by SeeJay »

Thanks for the hints.

I solved it by using 1 username / pwd for each folder to be accessed.
People need to make a choice before entering and use the appropriate pwd for that selection. (Different areas to access)

Those passwords will be given in game (2 pwds).
Once you have made your pick and continue flying the quest, you can't go back!
Unless you clone your profile before and use one for each selection.

Many peoples might want to do that anyway so they can fly / read all different endings.
(This depends on if we are going to make the quest like this.)
\"Nothing is impossible, it only takes a bit longer!\"
\"We are not retreating, we are advancing in another direction!\"


http://evochron.junholt.se (Old)
http://www.evochron2.junholt.se (New)
http://mercenary.junholt.se (Map)
http://www.junholt.se/evoschool/index.htm (No spoilers)
-8- Bzzzzzzzzz! -8- -8-
Image