The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
changing and adding a redirect path
#20
Ok. What about a different approach. What about a table called redirect_groups 2 columns.

Id, int(11), auto increment
and redirect,varchar(255)

Every time you insert a row into the db you put the path of the page you want that "group" to redirect to.
Then in your users table, you can either create a new column or use the unused account_id column.

Store the place you want that person to redirect in that column.

Then just make a function like
Code:
function redir($id){
Code:
$db = DB::getInstance();
Code:
$userQ = $db->query("SELECT account_id FROM user WHERE id = ?",array($id));
Code:
$found = $userQ->first();

Code:
$redirQ = $db->query("SELECT * FROM redirect_groups WHERE id = ?",array($found->account_id));
Code:
$redir = $redirQ->first();
Code:
Redirect::to($redir->redirect);
Code:
}

if that's not it for the function, it's close.

The other idea would be to make your user account levels a hierarchy. So, let's assume level 1 (user) is only for unvalidated users. 2 is admin. Then put your highest level user groups with the lowest level numbers. Then you can do a search of all the users and their permissions to find out what the highest (in this case lowest) permission level they have. So, your query would look like this.

Code:
$highestQ = $db->query("SELECT * FROM user_permission_matches WHERE permission_id !=1 AND user_id = ?",array($user->data()->id);
Code:
$highest = $highestQ->first();
//That just gave you the highest permission level that user has.

So now you make that same table.

Code:
if($highest==2){ //admin
Code:
Redirect::to('blah');
Code:
}

Basically this deals with users having multiple permission levels.

  Reply


Messages In This Thread
changing and adding a redirect path - by raven - 02-27-2017, 06:27 PM
changing and adding a redirect path - by mudmin - 02-27-2017, 07:05 PM
changing and adding a redirect path - by raven - 02-27-2017, 07:46 PM
changing and adding a redirect path - by mudmin - 02-27-2017, 10:50 PM
changing and adding a redirect path - by mudmin - 02-27-2017, 11:00 PM
changing and adding a redirect path - by raven - 02-28-2017, 01:56 AM
changing and adding a redirect path - by raven - 02-28-2017, 02:36 AM
changing and adding a redirect path - by dan - 02-28-2017, 03:57 AM
changing and adding a redirect path - by raven - 02-28-2017, 08:40 PM
changing and adding a redirect path - by mudmin - 02-28-2017, 09:19 PM
changing and adding a redirect path - by raven - 02-28-2017, 11:03 PM
changing and adding a redirect path - by raven - 02-28-2017, 11:20 PM
changing and adding a redirect path - by mudmin - 02-28-2017, 11:42 PM
changing and adding a redirect path - by raven - 03-01-2017, 01:39 AM
changing and adding a redirect path - by mudmin - 03-01-2017, 02:05 AM
changing and adding a redirect path - by raven - 03-01-2017, 02:28 AM
changing and adding a redirect path - by mudmin - 03-01-2017, 02:34 AM
changing and adding a redirect path - by raven - 03-01-2017, 03:00 AM
changing and adding a redirect path - by raven - 03-09-2017, 01:13 PM
changing and adding a redirect path - by mudmin - 03-09-2017, 09:50 PM
changing and adding a redirect path - by raven - 03-09-2017, 10:36 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)