|
#1
|
||||
|
||||
Help with page redirects
Does anyone know how I go about making a page only viewable by visitors, so if you're already a member it just takes you to a specific page? I know how to do page redirects, but I need something that checks to see if you're a specific group.
Basically I'm wanting my members to not be able to go to the home page unless logged out. So only visitors can access the page.
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion |
#2
|
||||
|
||||
You can use $mysidia->user->usergroup->gid to get the numerical value of the usergroup the current viewer has and block 'em out that way. Alternatively, $mysidia->user->usergroup should pull up a string version that is the name of the group. I can't remember off the top of my head what all the default usergroups are.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
#3
|
||||
|
||||
Does all this need done in the login.php file or index.php file? I'm so confused lol. The visitor group I think is the guest group and it's all number 6.
Edit: Oh my gosh!!! I got it! I had it in the wrong file! This is what I used: $group = $mysidia->db->select("users", array("usergroup"), "gid ='{$mysidia->user->gid}'")->fetchColumn(); switch($group){ case 1; //admin $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); case 2; //deluxe $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 3; //member $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 4; //beta tester $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 5; //moderator $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 6; //visitor break; }
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion Last edited by Micolai; 04-10-2021 at 01:03 PM. |
#4
|
||||
|
||||
So you know, you don't have to make a query for that information, its in the variable $mysidia->user->usergroup->gid, which exists in exactly the same way $mysidia->user->gid did in your query..
PHP Code:
PHP Code:
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 04-11-2021 at 02:50 PM. |
|
|
What's New? |
What's Hot? |
What's Popular? |