The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
hi,
how do i restrict a php to only a certain user group can use it, and others get a custom error message ( using a template ) ? there group i want to only access this is: usergroupid=2 could anyone help me please ? thanks for your time |
#2
|
|||
|
|||
![]()
this is how you do it Vinney
![]() PHP Code:
and place the error message in the template call the template whatever you want (ie. error_restricted) if you call it error_restricted then you must change eval the error template accordingly... ie: PHP Code:
![]() g-force2k2 |
#3
|
|||
|
|||
![]()
btw Vinney just place the first coding under the:
PHP Code:
g-force2k2 |
#4
|
|||
|
|||
![]()
this is what i've got so far ... it works.
<?php error_reporting(7); include ("../../mainfile.php"); $index = 1; global $Pmenu,$breadcrumb; $Pmenu=""; $breadcrumb="Account Activation"; $defaultmessage = "Your message here... \n\n - $bbuserinfo[username]"; $defaultemail = "$bbuserinfo[email]"; getvbpvars(); include("header.php"); //OpenTable(); if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==11) { eval("dooutput(\"".gettemplate('contact_error')."\ ");"); } else { eval("dooutput(\"".gettemplate('contact')."\");"); } //CloseTable(); include("footer.php"); ?> whats the difference between what i have done and what your saying ? does yours mean : if userid equals 2, get error template ... or does yours mean, if userid equals 2, continue ? |
#5
|
|||
|
|||
![]()
Vinny find this code:
PHP Code:
PHP Code:
then under that add my code... all my code states is that if the user trying to access the script isn't in the usergroupid 2 then they will recieve the error ![]() g-force2k2 |
#6
|
|||
|
|||
![]()
and .... sorry ( am a newbie - am just trying to get my head around this )
1. using your example, how would allow multiple usergroups ? -------------------------------- 2. in my example there is a line : if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==11) { what is the significance of - if (!$bbuserinfo[userid] being there ? is that needed ? thanks again. |
#7
|
|||
|
|||
![]() Quote:
my example does work. my require('./global.php'); is in the mainfile.php, that isn't an issue. |
#8
|
|||
|
|||
![]()
hey np Vinney thats why im here to help
![]() what do you mean allow multiple usergroups? if you want the script restricted to just usergroupid 2 then replace: PHP Code:
PHP Code:
as for the PHP Code:
![]() g-force2k2 |
#9
|
|||
|
|||
![]() Quote:
![]() ![]() ![]() g-force2k |
#10
|
|||
|
|||
![]()
ok
this works too : <?php error_reporting(7); include ("../../mainfile.php"); $index = 1; global $Pmenu,$breadcrumb; $Pmenu=""; $breadcrumb="Account Activation"; $defaultmessage = "Your message here... \n\n - $bbuserinfo[username]"; $defaultemail = "$bbuserinfo[email]"; getvbpvars(); include("header.php"); //OpenTable(); if (!$bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==11) { eval("dooutput(\"".gettemplate('contact_error')."\ ");"); } else { eval("dooutput(\"".gettemplate('contact')."\");"); } //CloseTable(); include("footer.php"); ?> |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|