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
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
changing and adding a redirect path - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: changing and adding a redirect path (/showthread.php?tid=481)

Pages: 1 2 3


changing and adding a redirect path - raven - 02-28-2017

yas that is the line of code i was after php and me dont get along well lol Big Grin


changing and adding a redirect path - raven - 02-28-2017

if(hasPerm([1],$user->data->id()){
Redirect::to('$us_url_root.'users/account.php');
}

if(hasPerm([2],$user->data->id()){
Redirect::to('$us_url_root.'users/admin.php');
}
?>


this is what i have now but it doesnt work it says syntax error ...


changing and adding a redirect path - mudmin - 02-28-2017

Sorry. My fault. It's
if(hasPerm([1],$user->data()->id){


changing and adding a redirect path - raven - 03-01-2017

dreamwever still reports a syntax on line 5

http://pastebin.com/MSWYyUt8




changing and adding a redirect path - mudmin - 03-01-2017

Dang it. haha

if(hasPerm([2],$user->data()->id)){

It's hard to do this when I'm not in my code editor.


changing and adding a redirect path - raven - 03-01-2017

lol beautiful

however i just noticed i have to add them in reverse order admin listed first then the others so it works as i intended lol


changing and adding a redirect path - mudmin - 03-01-2017

Yeah...if you are using a hierarchy.


changing and adding a redirect path - raven - 03-01-2017

well im done for the night severe storms rolling through my area tornados confirmed on the ground just a few miles away time to power off the servers for their protection meh oh well

lol they havent been off in over 1327 hrs for my ibm and 2332 hrs for my hp wow
55 days for the ibm and 97 days for my full time on server the hp


changing and adding a redirect path - raven - 03-09-2017

grrr this works as long as i only have one layer for redirect eg

<?php require_once 'init.php';
if (hasPerm([2], $user->data()->id)) {
Redirect::to($us_url_root.'users/adminaccount.php');
}
?>

as soon as i add in a second path on the top of the account pages it breaks

?>
<?php require_once 'init.php';
if (hasPerm([2], $user->data()->id)) {
Redirect::to($us_url_root.'users/adminaccount.php');
}
if (hasPerm([5], $user->data()->id)){
Redirect::to($us_url_root.'users/modaccount.php');
}
}?>


i eventually had intended to have more for additional perm layers

i originally went with building my own site because i though it would be more cost effective but it seems that what engin has is what i actually want

https://ravencraftnetworks.enjin.com/

its a free site

this is the user page with "permissions" they call them tags i didnt want to have to buy the ultra plan its 29 a month or more depending on if you add a ts3 server i would love to see the enjin system reverse engineered but i dont see that happening lol they have too much there donation craft etc but that could be integrated idk


changing and adding a redirect path - mudmin - 03-09-2017

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.