-1

I use post method to login the user, and after the user successfully login, they will be redirect to index.php. The problem is that every user gets the same home page url, instead, I want to have somthing like index.php/u=daniel so every one can have their own unique url

7
  • why a per-user url? Can't you just store their username in the session and go from there? Commented Jun 25, 2014 at 15:28
  • You log in the user. I assume this login session is known. Why don't you access some $_SESSION variable in index.php to tell if the user is logged in, and if this is the case alter the page? Even if that username was available during the login process, it doesn't make sense to have it as a get variable in your url. Commented Jun 25, 2014 at 15:32
  • How about a header redirect after the login? Commented Jun 25, 2014 at 15:32
  • i do store their user name into a session, and in the login.php(which validate the authentic user, if password and username match, they will be directed to home page, with location('header: index.php')), but i want something like index.php?u=username Commented Jun 25, 2014 at 15:32
  • probably, something like index.php/username is what i want, i didn't mean a get variable in my url Commented Jun 25, 2014 at 15:33

1 Answer 1

0

The instruction for doing what you want can be found here: php redirect with HTTP query string variables

However, I doubt it will be useful to have the username in the url. Like Marc said, you should just store the username in the session.

Sign up to request clarification or add additional context in comments.

1 Comment

I do store the username in the session, now, I have my url like profile.php for every user profile page, which makes no sense, and what I want is just to figure out a way to rewrite the url and change it into somthing like profile.php/u=username

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.