vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   User Re-Direct to NO PERMISSIONS (https://vborg.vbsupport.ru/showthread.php?t=318197)

MacroPhotoPro 04-10-2015 04:52 PM

User Re-Direct to NO PERMISSIONS
 
Have the following code to specify which users can use a custom page of mine:

Code:

// Permissions Redirect
        if ($usergroupid==8) {
                header("Location: $url_/payments.php");
        } else if ( ($usergroupid != 5) && ($usergroupid != 6) && ($usergroupid != 7) && ($usergroupid != 9) && ($usergroupid != 10) && ($usergroupid != 11) ) {
                header("Location: $url_/payments.php");
        }

This directs people to the payments.php page, but I have one "Administrative Only" page, where I don't want to direct them to payments.php, but where I want to elicit a No Permission message, so how do I code the above to accomplish this?

Thanks!!

kh99 04-10-2015 05:24 PM

You can call the function print_no_permission(), no parameters, like:
Code:

print_no_permission();

MacroPhotoPro 04-10-2015 05:34 PM

Okay so, code it like:

Code:

// Permissions Redirect
        if ($usergroupid==8) {
                header("print_no_permission");
        } else if ( ($usergroupid != 5) && ($usergroupid != 6) ) {
                header("print_no_permission()");
        }

Or do I do something different?

Thank you again for your help.

kh99 04-10-2015 05:39 PM

Well, more like this:
Code:

// Permissions Redirect
        if ($usergroupid==8) {
                print_no_permission();
        } else if ( ($usergroupid != 5) && ($usergroupid != 6) ) {
                print_no_permission();
        }

Also, I just remembered that there's a function called exec_header_redirect() that takes the url as a parameter, which you might want to use for your other redirects since it ends the script instead of going on and generating the rest of the page. To use that you'd replace
PHP Code:

header("Location: $url_/payments.php"); 

with
PHP Code:

exec_header_redirect("$url_/payments.php"); 


MacroPhotoPro 04-10-2015 05:58 PM

Awesome, that did the trick, thank you :D

--------------- Added [DATE]1428695984[/DATE] at [TIME]1428695984[/TIME] ---------------

Much appreciated!!


All times are GMT. The time now is 09:48 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01240 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete