Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 01-08-2009, 12:30 PM
manning manning is offline
 
Join Date: Apr 2007
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom page + conditionals

I am using the code below to create custom pages in my forum - I thought it was working great until I started testing for cross browser compatibility.

For the most part, the file works in IE, FF, and OPERA just fine, but when adding the conditional in red - OPERA will not display the page after logging in - it just redisplays the no permission/login page even though its logged me in.

Any idea why OPERA does this? I know its <2% of users, but I like to work on all browsers.

Code:
<?php  

// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS', 1); 
define('THIS_SCRIPT', 'my-file'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    'My_Template', 
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
require_once('global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 
if (!in_array($vbulletin->userinfo[usergroupid], array(2,6,7)))  
{   
print_no_permission();  
}  
$navbits = array(); 
$navbits[$parent] = 'My Page'; 

$navbits = construct_navbits($navbits); 
eval('$navbar = "' . fetch_template('navbar') . '";'); 
eval('print_output("' . fetch_template('My_Template') . '");'); 

?>
Reply With Quote
  #2  
Old 01-08-2009, 02:05 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How about instead of:
PHP Code:
if (!in_array($vbulletin->userinfo[usergroupid], array(2,6,7))) 
You use:
PHP Code:
if (is_member_of($vbulletin->userinfo2,6,7)) 
Reply With Quote
  #3  
Old 01-08-2009, 02:10 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is nothing in your PHP=code that is browser dependent. If there is a dependecy then it is in 1 of the templates used.
Reply With Quote
  #4  
Old 01-09-2009, 05:04 PM
manning manning is offline
 
Join Date: Apr 2007
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
There is nothing in your PHP=code that is browser dependent. If there is a dependecy then it is in 1 of the templates used.
Only thing in template is basic html ... nothing that would cause OPERA to keep returning no permission screen... thats in this php file.

Code:
{   
print_no_permission();  
}
Reply With Quote
  #5  
Old 01-09-2009, 05:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try commenting those lines out and see what the result is. Maybe it's some other function in global.php that is causing the problem.
Reply With Quote
  #6  
Old 01-10-2009, 01:38 AM
manning manning is offline
 
Join Date: Apr 2007
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well its important to me that page only allow certain groups in - If it dont work in OPERA oh well - was just wanting to see if I could find out why it wasnt working.
Reply With Quote
  #7  
Old 01-10-2009, 01:56 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If that function didn't work in Opera, don't you think a lot of vbulletin owners would be a bit peeved? That code is used throughout vbulletin only the condition used is a bit different (and, of course, other lines are different). Take a look at the other scripts that have no permission in them and you will see. I'm thinking something else is causing the problem in your script.
Reply With Quote
  #8  
Old 02-09-2009, 05:22 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
There is nothing in your PHP=code that is browser dependent. If there is a dependecy then it is in 1 of the templates used.
He's right, manning. PHP is a server-side script - it doesn't care what browser you're using, it will always deliver the same HTML/Javascript/XML to your end user.


Quote:
Originally Posted by manning View Post
Only thing in template is basic html ... nothing that would cause OPERA to keep returning no permission screen... thats in this php file.
Just how basic? Because some people use browser-dependent CSS with their HTML without realizing it. Some styles unwittingly use browser-dependent CSS too.


As an avid Opera user myself, I find that it's the other browsers that do funky things. After all, Firefox only just started passing the ACID 2 Browser Test (on the release build, FF has been passing for years on a few select nightly builds but they don't count). In fact, one thing that I absolutly detest about Firefox is that it makes assumptions about the code on the page - if a tag is not closed, Firefox will close it for you (this was a NIGHTMARE for some AJAX stuff). Needless to say, sometimes Firefox guessed where to close it incorrectly. I've had friends who abused the hell out of that feature, they would only write a quarter of the necessary code for a page to work properly and rely on Firefox to do everything else - when it didn't work for me they told me to switch to Firefox. I've come to loath the firefox subculture for that. But I digress...

I think the problem is that your other browsers cache is interfering with the results of the script. Force a re-download of the page

Firefox:
Hold shift and press the refresh button

Internet Explorer:
Hold CTRL and press the refresh button


If they don't come up with the same error that Opera does, then it's not what I think it is... However, if they do come up with errors then I think the problem is that you're missing this line from your PHP file:
Code:
global $vbulletin;
You can't use $vbulletin->userinfo[usergroupid] without knowing about $vbulletin in the first place (that it was defined in some other PHP file), and to do that you have to tell it that $vbulletin is defined globally.

Try printing the valueof usergroupid instead of printing no permission... That might give you a clue as to what the real cause is.




One time I had a very similar problem when it came to admin logins. After changing the subdomain on which vB was installed, vB couldn't find any of the cookie data. SessionIDs started appending to the ends of the URLs, and vB wouldn't even let me access the admin panel without a cookie login. I recommend that you upload the "tools.php" file from your "do_not_upload" folder and run the cookie repair utility just to rule out cookie settings errors.
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:16 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04378 seconds
  • Memory Usage 2,236KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete