vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   $vbulletin->userinfo['usergroupid'] (https://vborg.vbsupport.ru/showthread.php?t=160581)

squishi 10-19-2007 12:25 PM

$vbulletin->userinfo['usergroupid']
 
I need some help with coding.
I use the mod "login simple v1.10" in a non-vb page.

Code:

<?php
if ($vbulletin->userinfo['usergroupid'] == '17' )
        {
        echo "This is only visible to people in usergroup 17";
        }
?>

<br /><br />

<?php
if ($vbulletin->userinfo['usergroupid'] == '2' )
        {
        echo "This is only visible to registered users";
        }
?>

Usergroup 17 is a custom usergroup with only additional members and no primary members.
Usergroup 2 is the usual registered member group.

With a user who visits this page, only the second if-statement works.
Testing the usergroup 17 doesn't work.

What to do? Checking Usergroup 17 is what I want to do.

Andrew Green 10-19-2007 01:02 PM

Try this:

Code:

if (! is_member_of($vbulletin->userinfo, 17))
{
        print_no_permission();
}


squishi 10-19-2007 02:52 PM

This didn't work.

I want to check if the user is in usergroup 17 and show him the content of the page if it is true.

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

Okay, I modded it slightly and it works. :up:
Thanks.

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

I ran into another problem:
I want to load a file for the members of the usergroup 17.

The code looks like this:



If I remove the code between the //*** and remove the if statements, the file is loaded.
But it seems the header function collides with something in the forum's global.php?
I tried to puffer the output with ob_start / ob_flush, but it didn't work.
The script is doing nothing.

Dismounted 10-20-2007 11:13 AM

You're going to have to include the global.php file in order to use vBulletin's functions.

Analogpoint 10-20-2007 01:26 PM

Remove exit; (both of them.)

cagatayh 10-21-2007 09:49 AM

https://vborg.vbsupport.ru/showthread.php?t=160679

I want to do another thing. I want to

<?php
if ($vbulletin->forum['forumno'] == '67 ) like that...

for example;https://vborg.vbsupport.ru/forumdisplay.php?f=15

<?php
if ($vbulletin->forum['forumno'] == '15 ) like that...

squishi 10-21-2007 07:30 PM

Quote:

Originally Posted by Dismounted (Post 1364315)
You're going to have to include the global.php file in order to use vBulletin's functions.

Okay, I have replaced the "require_once" with "include" and removed the exits, but the script still does not produce any result.

Analogpoint 10-21-2007 09:01 PM

Quote:

Originally Posted by squishi (Post 1365385)
Okay, I have replaced the "require_once" with "include" and removed the exits, but the script still does not produce any result.

require_once does the same as include, except how it handles it if the file is not found, or if you try to include it more than once.

Post your code as you now have it.

squishi 10-22-2007 06:35 AM

Here's the full code (with changed paths):

If I leave out the global.php include and remove the usergroup check, the movies are loading...

Analogpoint 10-22-2007 01:22 PM

Try something like this. (untested)

PHP Code:

<?php

$curdir 
getcwd ();
chdir('/home/myforumpath.com/forum');
@include(
'/home/myforumpath.com/forum/global.php');
chdir ($curdir);

if (!
$vbulletin->userinfo['userid'])
{
    
// not logged in
    
echo "<html>";
    echo 
"<head>";
    echo 
"<title>";
    echo 
"Restricted Area";
    echo 
"</title>";
    echo 
"</head>";
    echo 
"<body>";
    @require_once(
'/home/pathtomyforum/login_inc.php'); //login_inc.php shows a login panel
    
echo "<br />Access only for members of group 17.";
    echo 
"</body>";
    echo 
"</html>";
}
else
{
    
// logged in
    
if (!is_member_of($vbulletin->userinfo17))
    {
        
// not a member of group 17
        
echo "<html>";
        echo 
"<head>";
        echo 
"<title>";
        echo 
"Restricted Area";
        echo 
"</title>";
        echo 
"</head>";
        echo 
"<body>";
        echo 
"<br />Access only for members of group 17.";
        echo 
"</body>";
        echo 
"</html>";
    }
    else
    {
        
// show the movies
        
$id intval($_GET['id']);
        switch (
$id) {
            case 
1:
                
$file "movies/showitifid1.avi";
                
$content_len = @filesize($file);
                
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0"); // HTTP/1.1
                
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Datum in der Vergangenheit
                
header('Pragma: no-cache'); //HTTP/1.0
                
header("Content-type: video/x-msvideo");
                
header("Content-type: octet-stream");
                
header('Content-Disposition: attachment; filename="'.$file.'"');
                if(
$content_len!=FALSE)
                {
                    
header("Content-length: $content_len");
                }
                
readfile($file);
                break;
            
            case 
2:
                
$file "movies/showitifid2.avi";
                
$content_len = @filesize($file);
                
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0"); // HTTP/1.1
                
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Datum in der Vergangenheit
                
header('Pragma: no-cache'); //HTTP/1.0
                
header("Content-type: video/x-msvideo");
                
header("Content-type: octet-stream");
                
header('Content-Disposition: attachment; filename="'.$file.'"');
                if(
$content_len!=FALSE)
                {
                    
header("Content-length: $content_len");
                }
                
readfile($file);
                break;
        }
    }
}

?>



All times are GMT. The time now is 06:18 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.01515 seconds
  • Memory Usage 1,767KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)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