Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2003, 08:44 PM
inthezone inthezone is offline
 
Join Date: Feb 2003
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default User Privileges on non-vB pages

I am looking to make certain non-vB pages on my site accessible on various levels (i.e. Certain parts are displayed for Registered Users, additional parts are displayed for Mods/Admins, and Guests are brought to the vB login screen,) using the vBulletin cookie, but I have no idea about:

1) How to require the cookie for access.

2) How to make certain parts accessible to certain user-levels.

Any help would be greatly appreciated. Thanks
Reply With Quote
  #2  
Old 02-22-2003, 10:53 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try these two hacks maybe?

http://www.vbulletin.org/hacks/index...ack&hackid=548

http://www.vbulletin.org/hacks/index...ack&hackid=282

- miSt
Reply With Quote
  #3  
Old 02-22-2003, 05:11 PM
inthezone inthezone is offline
 
Join Date: Feb 2003
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Those seem to use sessions, and I am looking to use cookies so users don't have to re-login every time. I want to have users login/register from the vB board itself, while the non-vB pages verify the cookie generated by vB. Is using the vB cookie on non-vB pages relatively safe, or is it opening a potential 'can of worms' of security risks?
Reply With Quote
  #4  
Old 02-22-2003, 06:06 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Saw something about cookies in this thread:

https://vborg.vbsupport.ru/showthrea...threadid=43014
Reply With Quote
  #5  
Old 02-23-2003, 08:07 PM
inthezone inthezone is offline
 
Join Date: Feb 2003
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That seems to just be a login portal for vB, but doesn't use the cookie for access to non-vB pages. What I am looking for (not a "hack" per se) is something that will allow me to do this on non-vB pages:

PHP Code:
//Not using literal PHP syntax

if (vBulletin cookie is present)
{

if (
user is a registered user)
{echo 
Regular user content;}
elseif (
user is a moderator)
{echo 
Mod content;}
elseif (
user in an administrator)
{echo 
Admin-only content;}

}

else {echo 
"You must be a registered user to view this page. Please login or register";} 
Reply With Quote
  #6  
Old 02-24-2003, 09:27 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you'll like WebTemplates
Reply With Quote
  #7  
Old 02-25-2003, 01:15 AM
inthezone inthezone is offline
 
Join Date: Feb 2003
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not really looking to hack up my vB, especially since vB3 is due out any month now. I noticed this bit of code in the thread for your hack:

PHP Code:
<?php
// Default Information - Start with this
error_reporting(7);

$templatesused='forumhome_welcometext,forumhome_logoutcode,forumhome_newposts,forumhome_todayposts,forumhome_logincode';

require(
'./global.php');

$permissions=getpermissions();
if (!
$permissions['canview']) {
    
show_nopermission();
}
// Default Information - End

// if user is know, then welcome
if ($bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
  eval(
"\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval(
"\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval(
"\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  
$welcometext "";
  eval(
"\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
  eval(
"\$logincode = \"".gettemplate('forumhome_logincode')."\";");
}

eval(
"dooutput(\"".gettemplate('home')."\");");


?>
Would something like this be adequate for permissions on non-vB pages?
Reply With Quote
  #8  
Old 02-25-2003, 03:16 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are ready to manually edit/update permissions per .php file without any user interface for administration, yes you can just insert:

PHP Code:
require('./global.php'); 
at the begining of your .php file (assumed its in the forum dir), then check the permissions with "if" commands like:

PHP Code:
if ($bbuserinfo['userid']>0
{
//do something
}
else
{
//do another thing

etc.
Reply With Quote
  #9  
Old 02-25-2003, 07:24 PM
inthezone inthezone is offline
 
Join Date: Feb 2003
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible to do this using a file that is not in my forums directory?

My directory structure is:

public_html
-forums
---admin
---images
---mod

I'm getting this error

PHP Code:
Warningmain() [function.main]: Unable to access ./admin/config.php in /home/virtual/www/public_html/forums/global.php on line 129

Warning
main(./admin/config.php) [function.main]: failed to create streamNo such file or directory in /home/virtual/www/public_html/forums/global.php on line 129 
and I'm using this code to get the global.php file:

PHP Code:
require('/home/virtual/www/public_html/forums/global.php'); 
Reply With Quote
  #10  
Old 02-25-2003, 07:34 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
chdir('/home/virtual/www/public_html/forums/');
require(
'./global.php'); 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:07 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.05383 seconds
  • Memory Usage 2,286KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete