vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   in_array problems (https://vborg.vbsupport.ru/showthread.php?t=123346)

VodkaFish 08-07-2006 11:55 PM

in_array problems
 
I was using this to set permissions on a php page:

PHP Code:

if (in_array($vbulletin->userinfo['usergroupid'], array(1348))) { 
    
print_no_permission(); 


However, now that I've upgraded to php 5 (and vb 3.6), it's simply blocking everyone, not just those usergroups. I don't really see any difference for in_array between php 4 and 5, did something change in vb?

Freesteyelz 08-08-2006 06:02 AM

I think it should be:

Code:

if (is_member_of($vbulletin->userinfo, 1, 3, 4, 8))

VodkaFish 08-08-2006 06:19 AM

Thanks for the response. I gave that a shot earlier and it's weird, everyone is still being blocked.

If I do:
PHP Code:

echo is_member_of($vbulletin->userinfo['usergroupid'], array(1348)); 

I get nothing.
PHP Code:

echo $vbulletin->userinfo['usergroupid']; 

I get my correct usergroupid.
PHP Code:

echo is_member_of($vbulletin->userinfo1348); 

I get nothing again.

Dilmah 08-08-2006 06:29 AM

is_member_of($vbulletin->userinfo, 1,3,4,8);

VodkaFish 08-08-2006 06:43 AM

Unfortunately that produces the same result.

Dilmah 08-08-2006 06:52 AM

What's code did you use?

VodkaFish 08-10-2006 03:02 PM

Quote:

Originally Posted by Dilmah
What's code did you use?

I tried both:
PHP Code:

if (in_array($vbulletin->userinfo['usergroupid'], array(1348))) { 
    
print_no_permission(); 


and
PHP Code:

if (is_member_of($vbulletin->userinfo1,3,4,8)) { 
    
print_no_permission(); 



Paul M 08-10-2006 05:36 PM

Use this and post the full results back here;

PHP Code:

print_r($vbulletin->userinfo);
if (
is_member_of($vbulletin->userinfo1,3,4,8)) 
{  
    echo 
"No Permission <br />";  
}
exit; 


VodkaFish 08-10-2006 05:47 PM

Array ( [userid] => 2105 [usertitle] => Owner [customtitle] => 1 [joindate] => 949813200 [daysprune] => 0 [lastvisit] => 1155232031 [lastactivity] => 1155232031 [lastpost] => 1155229271 [posts] => 12168 [timezoneoffset] => -5 [membergroupids] => [displaygroupid] => 6 [reputation] => 350

Paul M 08-10-2006 06:09 PM

I've removed alot of the unnecessary stuff from your post

You are a member of usergroup 6 and didn't get "No Permission" echoed out, so it seems to be working to me.


All times are GMT. The time now is 10:59 PM.

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.01124 seconds
  • Memory Usage 1,745KB
  • 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
  • (1)bbcode_code_printable
  • (7)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete