Page 2 of 2

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 5:18 am
by Apollo
Note that you shouldn't store the joe.pw file in the same dir (so not in clients.mydomain.com/joe).

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 1:53 pm
by antoine
I still haven't been able to get it to work. But I've also decided that it isn't nearly as appropriate as a dynamic PHP redirect would be...

You any good with PHP?!

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 1:58 pm
by alex.barylski
You any good with PHP?!
Most frequent visitors on this site will be more than capable in PHP, over 2k or 3k posts should tell you they are likely professionals.

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:04 pm
by antoine
I meant that as a joke. I would like someone to help me add this redirect I have talked about, using a PHP code.

I lost myself.

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:09 pm
by RobertGonzalez
Are you using any type of included file anywhere in the client section?

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:14 pm
by antoine
I have a config.php included in pretty much every processor.php file...

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:25 pm
by RobertGonzalez
Add client login handling there.

Seriously, you can probably make this easier by using a little mod_rewrite too. Set up a handler for all things that hit domain.com/<something> and map that to domain.com/clients.php?clientname=$1 or something like that.

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:32 pm
by antoine
Ok, from the top I will try to explain this as best I can, so that hopefully we can get on the same page and I can stop nagging you (I thank and appreciate you for sticking around this long!).

I have implemented a script that includes static HTML pages with forms such as the login using PHP pages to process them.

I have a row in my MySQL database called "redirect" and it specifies which page each user is automatically redirected to, upon logging in. Mine is the admin page, where I can edit/add/email/delete/ban users, etc., and the rest of my clients are clients.mydomain.com/clientusername/index.html.

On this index page is a list of options such as log out, email admin, and then there are client-specific links. For example, on Joe's page, it might say "Preview Joe's Webpage". Where this would redirect to clients.mydomain.com/joe/web/index.html (the home page of his website).

This is all working just fine, but the thing that I don't like is that anyone can just put "http://clients.mydomain.com/joe/index.html" or "http://clients.mydomain.com/joe/web/index.html" and the page shows up no problem.

What I would like it to do, using PHP is first check to see if anyone is logged in (if not, send them to the login page), and then check who is logged in (probably by using the $_SESSION[username] variable). Then I compare it to see if that user's "redirect" URL is in this or not.

That way if Bob or Jim goes on, it will see that it is not their "redirect", so it pushes them to their redirect page.

However, it also needs to recognize the 'admin' username as a "skeleton key", so as long as I am logged in, I am free to roam.

I hope this helps to clear this up. I know it's hard because I can't give you specifics and because, well, I'm obviously not PHP-inclined.

So thanks for sticking around.

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:45 pm
by RobertGonzalez
What is the admin users username?

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 2:58 pm
by antoine
admin

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 3:35 pm
by RobertGonzalez
So this takes us back to where we started. Check the request URI if you are not admin and see if the uri is the same as the username. If it is not, move them someplace else. If it is, allow them in. For admin, bypass all of that.

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 3:36 pm
by antoine
I understand that. I just can't figure out how to do it...

Re: Is there an easy way to do this? (Adding a Client Login)

Posted: Mon Jul 21, 2008 3:47 pm
by RobertGonzalez
viewtopic.php?p=474175#p474175

Basically compare the current uri to who they are. If it is the same (or the user is admin if uri != username) then move them to a different location.