Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
3 methods for enabling debug mode for site admin ONLY
Oracle simsim
Join Date: Dec 2009
Posts: 23

 

Iraq
Show Printable Version Email this Page Subscription
Oracle simsim Oracle simsim is offline 06-29-2011, 10:00 PM

We will explain here how to turn on debug mode for LIVE vbulletin website for site admin only.


We all know that we can enable debug mode by add this line to /include/config.php

PHP Code:
$config['Misc']['debug'] = true


but .. this will enable debug mode for everyone else .. not just the admin. even if you close your forum, the debug mode still running and showing critical information about your site). This is good only on your private forum on your test server.

why this happen ?? why vbulletin team does not enable debug mode for the admins only ??? I am sure that's because the debug functions must run (before) the forum know that (this visitor is admin!) i.e. before pulling user information from db and checking his user group id/permissions.

so.. what we can do to enable the debug mode for webmaster only ?


Method (1)-By using (Secret Query String):


below the last line in your config.php add this

PHP Code:
$debug_mode_secret_query="3003"//CHANGE this to your own secret value (letters and numbers only)
// Do Not Edit Below
if ($_GET["debug"]==$debug_mode_secret_query$config['Misc']['debug'] = true

remember to change your secret debug mode number (i.e. $debug_mode_secret_query variable value)
save & upload config.php

now .. if you want to see your live site in debug mode .. add the query string to any page url in your forum.

Examples:

Code:
https://www.yourforum.com/forum/forum.php?debug=3003
https://www.yourforum.com/forum/showthread.php?t=189992&debug=3003


Advantages:
1- You can turn on the debug mode of your forum from any place, IP or browser.
2- Turn debug mode on only if you want (not every time you open your forum pages)
Disadvantages:
1- You need to add the query string part manually each time you visit new page.
2- Spiders or Alexa may catch that URL with that query string if you have installed a spyware toolbar like alexa, page rank, etc (really ?)






Method (2)-By Adding secret Custom HTTP Request header to your browser:




Firstly, add a custom header to your browser. The best and easiest way to do that is to install (Modify Headers firefox Add-on by Gareth Hunt ) for your firefox, then add your custom request header via its option

Header name: debug
header value: 3003 (change this value to your own secret value)
Always ON the add-on from General tab


check the request header if it is sent correctly along with your other browser request headers.


now .. put this code in your config.php below the last line
PHP Code:
$debug_mode_secret_header="3003"// Change this value to be the same as your custom header value i.e. 3003 in our example. 
// Do Not Edit Below
if ($_SERVER["HTTP_DEBUG"]==$debug_mode_secret_header$config['Misc']['debug'] = true

Advantages:
1- Turn Debug mode on for that browser for your forum without typing anything manually.
2- Don't care about your IP or ISP.
Disadvantages:
1- Unless you disable your custom header (via the add-on options) you will see your forum in Debug mode every time in that browser.
2- Your custom header will be sent with every request to any page in internet for that browser (emm so what ? )


Method (3)-By Your unchangeable & unique IP:


If your Client Public IP Address is unchangeable and unique, You can make use of it to enable the debug mode for yourself Only

record Your Unique IP then add this code below the last line in your config.php

PHP Code:
$my_unique_ip="109.224.28.1"// Change this IP to your Unique IP. 
// Do Not Edit Below
if ($_SERVER["REMOTE_ADDR"]==$my_unique_ip$config['Misc']['debug'] = true



Advantages:
1- Turn Debug mode on any browser you have installed without typing anything manually.
Disadvantages:
1- You will see your forum in Debug mode every time you visit your forum from that internet line.
2- If your ISP share your public IP with other clients, those clients will also see your forum in debug mode as well as you.
3- If your ISP change your public IP or you visit the forum outside your home, no more debug mode even with the same laptop (unless you change the code again with the new IP).


original thread
http://www.kut-friends.com/Thread-vb...ite-admin-ONLY

Sorry about the weak english


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

Thanks for information dear ..
Reply With Quote
  #2  
Old 03-24-2013, 05:37 PM
matrex722's Avatar
matrex722 matrex722 is offline
 
Join Date: Jan 2007
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice and great work
i think i will do that
but is that works with 3.8 forums ?
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 08:51 AM.


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.09727 seconds
  • Memory Usage 2,218KB
  • Queries Executed 17 (?)
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)bbcode_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (3)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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