04-30-2019, 03:37 PM
(04-25-2019, 08:14 PM)maxikz Wrote: ok so username. = user that just logged in..
what I am trying to accomplish ::>
if user= admin log in send to to x.html
if user = Steven send him to w.html
if user = Alex send him to 564.html ?
$url = strtolower($user->data()->username);
Redirect::to($us_url_root.$url);
John goes to example.com/john
James goes to example.com/james
Or if you want to redirect to other pages, add a field in the users database table that contains the destination
Code:
// this adds a field into the users table
// this field holds the page to redirect to
ALTER TABLE users ADD redirect_page VARCHAR(100); // create a new field in the users table to hold the redirect_page
//then add the actual page to redirect to. do this for every user that needs redirected
$d = DB::getInstance();
$query = $db->query("UPDATE users
SET redirect_page = 'https://example.com/x.html'
WHERE username = 'john' ");
$results = $query->results();
Now when john logs in, you can..
$query = $db->query("SELECT redirect_page from users WHERE username = 'john' ")'
$results = $query->results();
Now you have the page to redirect to inside $results. now you can do the redirect.
My code is not exact. just an example and an idea for you.