How to automatically generate and redirect the link in the header

Asked

Viewed 46 times

0

I am needing to generate a system where I have a template page (the fb profile for example) and that will be fed by my database with the information according to a user’s ID. My problem is: I do not want the link of the parameter passed (id) to be exposed in the page header but a variable of that user who gave query (his user for example) and at the same time if I access this link (www.meusite.com/user) it is redirected to that same page (giving the query in BD and pulling the information normally)

This is possible via PHP or JS?

Thanks in advance!

1 answer

1

It is possible yes,

To configure the page url see these links: How to Make URL Friendly or How do I make url friendly in PHP

For testing you can pick up the current url with $_SERVER["REQUEST_URI"]

With JS there is a question here in Stackoverflow about picking url from previous page

With the value of this url you can use the functions substr() to take the value after the "/" and send to the control of your system, there you make the query by passing this value

To send the id user without being by $_GET you can use $_SESSION or $_POST

Browser other questions tagged

You are not signed in. Login or sign up in order to post.