vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Help! How to add User Access Restrictions on NON VB pages? (https://vborg.vbsupport.ru/showthread.php?t=202031)

BlackJacket 01-16-2009 06:23 PM

Help! How to add User Access Restrictions on NON VB pages?
 
I wanted to know how i could use the access restrictions on non VB pages? Like if i have a role of "Paid User" and they have special access to certain forums, how could i also give them certain access to non VB pages that i might have?

Thank you!

V3.8.0

gct13 01-16-2009 06:42 PM

Using this mod could probably help you out:

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

BlackJacket 01-17-2009 10:32 AM

Where do i add this code?

PHP Code:

<?php 
if ($vbulletin->userinfo['usergroupid'] == '6' 
    { 
    echo 
"Have stuff for here"
             } else { 
             echo 
"You do not have permission for this page"; } 
    
?>

I tried but the webpage is still visable.

Thanks!

Dismounted 01-17-2009 11:47 AM

You must include global.php for the code to work.

BlackJacket 01-28-2009 01:46 AM

Quote:

Originally Posted by Dismounted (Post 1715638)
You must include global.php for the code to work.

I need help. I have been at this for hours and i still have not figured it out.

I want this page to only be displayed to moderators and administrators. But its not working when i try to input ANY of the php scripts included with that hack.

PLEASE HELP! :D:D

Thanks again

Lynne 01-28-2009 02:38 AM

Did you start from reading these articles - How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

You'll need to post some of your code if you want us to help you with it. Please use the code/html/php tags so it is easier to read.

BlackJacket 01-28-2009 02:44 AM

Quote:

Originally Posted by Lynne (Post 1726771)
Did you start from reading these articles - How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

You'll need to post some of your code if you want us to help you with it. Please use the code/html/php tags so it is easier to read.

yes and the only one that remotely worked was -

PHP Code:

if (!is_member_of($vbulletin->userinfo6) AND !is_member_of($vbulletin->userinfo7)) 

        
print_no_permission(); 


But it puts that huge login box in the middle of the page and its not even. I just want to block the page but have it look clean instead of a mess like it looked with the previously mentioned code.

:)

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

The main information that i do not want regular user's to see -

HTML Code:

<div class="box1">
                                        <div class="border-top">
                                            <div class="border-right">
                                              <div class="border-bot">
                                                  <div class="border-left">
                                                    <div class="left-top-corner">
                                                        <div class="right-top-corner">
                                                          <div class="right-bot-corner">
                                                              <div class="left-bot-corner">
                                                                <div class="inner2">
                                                                    <h2>Legend Guide</h2>
                                                                    <p>Welcome to the Moderator Control Panel.  More info will be posted soon as well as more tools.  The navigation links above (Garage, Forums, etc...) are not working yet.  Please
                                                                                                                                <a href="http://1320legend.com/index.php">click here</a> to go to the index or Garage.</p>
                                                                                                                                                                <p><a href="http://1320legend.com/community/forumdisplay.php?f=35" target="_blank">Click here</a> for Mod Lounge</p>
                                                                                                                                                                <p><a href="http://1320legend.com/community/modcp/index.php" target="_blank">Mod Control Panel for forum</a></p>
                                                                                                                                       
                                                            </div>
                                                        </div>
                                                      </div>
                                                  </div>
                                                </div>
                                            </div>
                                          </div>
                                      </div>
                                    </div>
                                </div>


Lynne 01-28-2009 03:16 AM

This code doesn't put any html on a page at all so I'm not sure what you are talking about:
PHP Code:

if (!is_member_of($vbulletin->userinfo6) AND !is_member_of($vbulletin->userinfo7))  
{  
        
print_no_permission();  



BlackJacket 01-28-2009 03:23 AM

Quote:

Originally Posted by Lynne (Post 1726800)
This code doesn't put any html on a page at all so I'm not sure what you are talking about:
PHP Code:

if (!is_member_of($vbulletin->userinfo6) AND !is_member_of($vbulletin->userinfo7))  
{  
        
print_no_permission();  



I was trying everything that this thread said to.

Lynne 01-28-2009 03:45 AM

Well, that article should just give you a basic vb page with the header and navbar up top and a footer at the bottom and whatever you put in the template in the middle. If you include the global.php page and then that no permission code you posted in your php page, it should restrict access to your page. It's hard to tell what is wrong without seeing the php code.

BlackJacket 01-28-2009 03:59 AM

Quote:

Originally Posted by Lynne (Post 1726822)
Well, that article should just give you a basic vb page with the header and navbar up top and a footer at the bottom and whatever you put in the template in the middle. If you include the global.php page and then that no permission code you posted in your php page, it should restrict access to your page. It's hard to tell what is wrong without seeing the php code.


I can PM it to you. Is that ok?

Dismounted 01-28-2009 05:12 AM

Is there any reason why you cannot simply post it?

BlackJacket 01-28-2009 09:54 AM

Quote:

Originally Posted by Dismounted (Post 1726876)
Is there any reason why you cannot simply post it?

I have some php that requires my username and pass for the DB.

I dont know if you guys want the code all cut up because i would have to remove that information. You wouldnt be able to see the full code.

Dismounted 01-28-2009 10:07 AM

Just blank out the username and password (should only be once, anyway), and post the code. Unless there is more sensitive information?

BlackJacket 01-28-2009 10:28 AM

Quote:

Originally Posted by Dismounted (Post 1727053)
Just blank out the username and password (should only be once, anyway), and post the code. Unless there is more sensitive information?

Ok. :)

HTML Code:

<?php
$curdir = getcwd ();
chdir('Edited..html/community');
require_once('edited/community/global.php');
chdir ($curdir);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>1320LEGEND | Legend Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="en" />
<meta name="description" content="Guide to playing 1320LEGEND. Learn to Race, Tune, Shop, plus much more on the Free Online Drag Racing game, 1320LEGEND!" />
<meta name="keywords" content="1320, 1320 legend, guide, tune help, learn tuning, manual" />
<link href="../style.css" rel="stylesheet" type="text/css" />
<link href="../layout.css" rel="stylesheet" type="text/css" />
</head>

<body id="page3">
        <div class="tail-top">
      <div class="tail-center">
        <div id="main">
            <!-- header -->
            <div id="header">
              <!--Valid flash version 8.0-->
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
                          width="980" height="295">

              <param name="movie" value="flash/header3_fv8.swf?button=3" />
              <param name="quality" value="high" />
              <param name="menu" value="false" />
              <param name="wmode" value="transparent" />
              <!--[if !IE]> <-->
              <object data="flash/header3_fv8.swf?button=3"
                          width="980" height="295" type="application/x-shockwave-flash">

              <param name="quality" value="high" />
              <param name="menu" value="false" />
              <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
              <param name="wmode" value="transparent" />
              FAIL (the browser should render some flash content, not this).
              </object>
              <!--> <![endif]-->
              </object>
            </div>
            <!-- content -->
            <div id="content">
                    <div class="main-box">
                      <div class="top">
                          <div class="bottom">
                            <div class="inside">
                                <div class="wrapper">
                                  <div class="left-column">
                                      <div class="box">
                                        <div class="top">
                                            <div class="bottom">
                                              <div class="inner">
                                                  <h2>1320LEGEND Login</h2>
                                            <div class="inner1">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="alt1" width="100%">
<?php
  require_once('/home/content/n/i/t/nittospace/html/community/login_inc.php');
?>
 

        </td>       
       

       
</tr>
</table>
                                            </div>
                                            <h3>Recent Topics</h3>
                                            <div class="inner1">
                                                    <?php
##########################################################################
// RECENT TOPICS by LBmtb
// Version 1.03
// webmaster@socaltrailriders.org OR aim: LBmtb
//
// Do not remove copyright unless you donate $5 via paypal
// to the above email address, thanks
// CUSTOMIZED from a www.phase1media.com script found here:
// https://vborg.vbsupport.ru/showpost.php?p=589067&postcount=7
##########################################################################

## CUSTOMIZE THE FOLLOWING    ##############################################

// DATABASE & URL SETTINGS
$db_host = "p50mysql283.secureserver.net"; // Change this if your MySQL database host is different.
$db_name = ""; // Change this to the name of your database.
$db_user = ""; // Change this to your database username.
$db_pw = ""; // Change this to your database password.
$db_prefix = ""; // Change to your tables' prefix. Usually vb_
$forum_url = "http://www.1320legend.com/community"; // Change this to reflect to your forum's URL.

// APEARANCE OPTIONS
$seperator = "@"; // this goes between last poster and date
$limit = "3"; // Number of posts displayed
$post_date_format = "1"; // leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw = ""; // ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw = ""; // Exclude threads from these forum. seperate each ID with a comma

// CSS CLASSES   
$recent_topics = "vb_topics"; // you can use CSS to adjust the presentation of the list
$recent_poster = "vb_last_post";  // you can use CSS to adjust the presentation the last poster and date

## NO NEED TO TOUCH ANYTHING BELOW    #####################################
#############################################################################

if (!($recent_topics_connection = mysql_connect("$db_host", "$db_user", "$db_pw")))
die ("could not connect");
if (!(mysql_select_db("$db_name", $recent_topics_connection)))
mysql_error();
echo "<ul class=\"$recent_topics\">\n";
$fid_array = explode (',', $fid_raw);
if ($fid_raw)  {
    $fid_final .= "AND (";
    foreach( $fid_array as $key =>
$value){
        if ($key == 0) { $fid_final .= "t.forumid=".$value; }
        else { $fid_final .= " OR t.forumid=".$value; }
    }
    $fid_final .= ")";
}
$fidx_array = explode (',', $fidx_raw);
if ($fidx_raw)  {
    $fidx_final .= "AND NOT (";
    foreach( $fidx_array as $key => $value){
        if ($key == 0) { $fidx_final .= "t.forumid=".$value; }
        else { $fidx_final .= " OR t.forumid=".$value; }
    }
    $fidx_final .= ")";
}
$thread_sql = mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,90) as post_text
        FROM ".$GLOBALS['db_prefix']."thread t
        INNER JOIN ".$GLOBALS['db_prefix']."post p
        ON t.firstpostid = p.postid
        WHERE t.visible=1
        AND t.open=1 $fidi_final $fidx_final
        ORDER BY t.lastpost desc
        LIMIT $limit");
while($thread_get=@mysql_fetch_array($thread_sql))
{
    $lastpost = $thread_get['lastpost'];
    $poster = $thread_get['lastposter'];
    $tid = $thread_get['threadid'];
$text = $thread_get['post_text'];
    if ($post_date_format == "1") { $date2 = date ("m/d/y h:i A" ,$lastpost); }
    elseif ($post_date_format == "2") { $date2 = date ("h:i A" ,$lastpost); }
    else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
            echo "<li><a href=\"$forum_url/showthread.php?t=$tid\" title=\"".$text."\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";
}
mysql_close($recent_topics_connection);
?>
                                                <div class="txt1"><strong>
                                                                                                        <a href=""></a></strong></div>
                                            </div>
                                            <div class="alignright">
                                                                                                <a class="link1" href="../community/index.php">Read More</a></div>
                                          </div>
                                      </div>
                                    </div>
                                </div>
                              </div>
                              <div class="center-column">
                                      <div class="box1">
                                        <div class="border-top">
                                            <div class="border-right">
                                              <div class="border-bot">
                                                  <div class="border-left">
                                                    <div class="left-top-corner">
                                                        <div class="right-top-corner">
                                                          <div class="right-bot-corner">
                                                              <div class="left-bot-corner">
                                                                <div class="inner2">
                                                                    <h2>Legend Guide</h2>
                                                                    <p>Welcome to the Moderator Control Panel.  More info will be posted soon as well as more tools.  The navigation links above (Garage, Forums, etc...) are not working yet.  Please
                                                                                                                                <a href="http://1320legend.com/index.php">click here</a> to go to the index or Garage.</p>
                                                                                                                                                                <p><a href="http://1320legend.com/community/forumdisplay.php?f=35" target="_blank">Click here</a> for Mod Lounge</p>
                                                                                                                                                                <p><a href="http://1320legend.com/community/modcp/index.php" target="_blank">Mod Control Panel for forum</a></p>
                                                                                                                                       
                                                            </div>
                                                        </div>
                                                      </div>
                                                  </div>
                                                </div>
                                            </div>
                                          </div>
                                      </div>
                                    </div>
                                </div>
                              </div>
                          </div>
                        </div>
                    </div>
                  </div>
              </div>
            </div>
            <!-- footer -->
            <div id="footer">
                    <p>1320LEGEND ? 2008&nbsp;&nbsp; |&nbsp;&nbsp; ReaxtionStudios.com&nbsp;&nbsp;
                                |&nbsp;&nbsp; <a href="privacy-policy.html">Privacy Policy</a>&nbsp; |&nbsp;
                                <a href="refund-policy.html">Refund Policy</a></p>
                                <p><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=164585129504c246eb212711e1ddf4d2b17df9063538959879293121"></script><br/></span></p>            </div>
        </div>
      </div>
  </div>
</body>
</html>


Lynne 01-28-2009 02:15 PM

Your no permission should go right at the top after you include global.php:

HTML Code:

<?php
$curdir = getcwd ();
chdir('Edited..html/community');
require_once('edited/community/global.php');
if (!is_member_of($vbulletin->
userinfo, 6) AND !is_member_of($vbulletin->userinfo, 7)) 

        print_no_permission(); 

chdir ($curdir);
?>


BlackJacket 01-28-2009 03:28 PM

Quote:

Originally Posted by Lynne (Post 1727251)
Your no permission should go right at the top after you include global.php:

HTML Code:

<?php
$curdir = getcwd ();
chdir('Edited..html/community');
require_once('edited/community/global.php');
if (!is_member_of($vbulletin->
userinfo, 6) AND !is_member_of($vbulletin->userinfo, 7)) 

        print_no_permission(); 

chdir ($curdir);
?>


Did that but it does that whole big log in box thing that looks horrible.

Maybe if i could just hide the text instead? Do you know how to do that?

Thank you Lynne for dealing with my issues, lol. :D:D

Lynne 01-28-2009 05:12 PM

Aaaaaaacccccckkkkkk! Now I know what you are talking about! Geez, sometimes it takes me a few minutes... or days... argh!

OK, I think what may be better for you is in your template, go like this:
HTML Code:

<if condition="is_member_of($bbuserinfo, 6, 7)">
put all the stuff for your mods and admins here
<else />
put your message that says they have no permission to be on this page
</if>


BlackJacket 01-28-2009 05:20 PM

Quote:

Originally Posted by Lynne (Post 1727392)
Aaaaaaacccccckkkkkk! Now I know what you are talking about! Geez, sometimes it takes me a few minutes... or days... argh!

OK, I think what may be better for you is in your template, go like this:
HTML Code:

<if condition="is_member_of($bbuserinfo, 6, 7)">
put all the stuff for your mods and admins here
<else />
put your message that says they have no permission to be on this page
</if>


Can i put that anywhere or does have to be after global.php?

Lynne 01-28-2009 05:39 PM

That would go into the template. Except, you aren't using a template are you. Ugh. OK, then back to php.... you will have to put a condition around all the html in your page that you don't want users to see and then another condition around the html in your page that you do want the users to see - like this:

PHP Code:

<?php

if (is_member_of($vbulletin->userinfo67))  
{   
?>
a bunch of html to only show to users in group 6 or 7
<?php

}  
?>

And then, when you have html that you only want to show to the non mods/admins:

PHP Code:

<?php

if (!is_member_of($vbulletin->userinfo67))     
{   
?>
a bunch of html to only show to users NOT in group 6 or 7
<?php

}  
?>


BlackJacket 01-28-2009 05:45 PM

Quote:

Originally Posted by Lynne (Post 1727414)
That would go into the template. Except, you aren't using a template are you. Ugh. OK, then back to php.... you will have to put a condition around all the html in your page that you don't want users to see and then another condition around the html in your page that you do want the users to see - like this:

PHP Code:

<?php

if (is_member_of($vbulletin->userinfo6) AND is_member_of($vbulletin->userinfo7))   
{   
?>
a bunch of html to only show to users in group 6 or 7
<?php

}  
?>

And then, when you have html that you only want to show to the non mods/admins:

PHP Code:

<?php

if (!is_member_of($vbulletin->userinfo6) AND !is_member_of($vbulletin->userinfo7))   
{   
?>
a bunch of html to only show to users NOT in group 6 or 7
<?php

}  
?>


lol thank you. I will try this now. :)

Lynne 01-28-2009 05:48 PM

I just changed the conditions you had used and shortened them in the post I made above.

BlackJacket 01-28-2009 05:51 PM

PHP Code:

<?php 

if (is_member_of($vbulletin->userinfo6) AND is_member_of($vbulletin->userinfo7))    
{    
?> 
a bunch of html to only show to users in group 6 or 7 
<?php 

}   
?>

This blocks content even from mods/admins.

Lynne 01-28-2009 06:54 PM

I made a post about how I changed that condition since it was wrong. Look at the post above yours and then at my original post with the conditions two posts above that.

BlackJacket 01-28-2009 07:23 PM

This worked great!

Thank you very, VERY VERY VERY VERY much Lynne. You really worked hard for just a regular user like me. Thank you very much. :)

Lynne 01-28-2009 07:32 PM

Glad you got it working!


All times are GMT. The time now is 04:45 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.01823 seconds
  • Memory Usage 1,915KB
  • 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
  • (6)bbcode_html_printable
  • (9)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (26)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