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-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

}  
?>



All times are GMT. The time now is 11:27 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.01227 seconds
  • Memory Usage 1,841KB
  • 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
  • (5)bbcode_html_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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