Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Show debug console for certain IP's only

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 11-06-2010, 03:43 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,040
 

Default Show debug console for certain IP's only

This should be a standard future in xcart but it's not. Every time you turn on the debug console anyone visiting the site can see it and gather data fom your site. I've seen so many open stores with the console on. Maybe QT will get this and put it in admin as a setting in future releases. So here it is:

Open init.php and find
Code:
if($config["General"]["enable_debug_console"]=="Y" || $editor_mode=='editor') $smarty->debugging=true;

and replace with
Code:
# added by CFL Systems # use this format to add ip addresses to the list # $ips_array = array('xxx.xxx.xxx.xxx','xxx.xxx.xxx.xxx'); $ips_array = array('the_ip_you_want_to_use_see_above_for_example'); $my_ip = $_SERVER['REMOTE_ADDR']; # modified by CFL Systems to include IP address if(in_array($my_ip,$ips_array) && ($config["General"]["enable_debug_console"]=="Y" || $editor_mode=='editor')) $smarty->debugging=true;

This will show the console only to IP's from the list so you can have it on if you need to and make sure no one else can see it.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
am2003 (11-08-2010), gb2world (11-06-2010)
  #2  
Old 11-06-2010, 04:33 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Show debug console for certain IP's only

Perhaps this feature should be added to the SECURITY_BLOCK_UNKNOWN_ADMIN_IP functionality defined here .

That way - the concept of having having approved ip's for administrators could be managed from the same functionality that already exists.

----
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #3  
Old 11-06-2010, 08:33 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,040
 

Default Re: Show debug console for certain IP's only

That could be yes, or maybe this

$admin_allowed_ip = "";

from config.php can be used. I just had to put something together real fast on a live site.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #4  
Old 11-08-2010, 03:54 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Show debug console for certain IP's only

I thought it only opened it for the admin user! I can't believe this is open to any visitor, crazy!

I don't have a dedicated IP at home where I do a lot of modding, so is there a way I can limit this to a logged in admin user?

I'd appreciate any help.
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #5  
Old 11-08-2010, 07:56 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,040
 

Default Re: Show debug console for certain IP's only

Not sure if userinfo is available in init.php. You can try $login == "your login" or $userinfo["login"] == "your login" or $userinfo["username"] == "your login".
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 11-17-2010, 03:44 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Show debug console for certain IP's only

I used $userinfo["username"] == "your login" and it seems to be fine, i could use webmaster on my desktop, but if i went to the site from my laptop (not logged in) it didn't appear.

ideally it should save the user than enables it and only show it for that user?

as there's only me it doesn't matter
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #7  
Old 11-17-2010, 06:21 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Show debug console for certain IP's only

Just to be clear - the issue is not with Webmaster Mode, but with the debug console option - correct?

Also - I'm curious if there is a reason you use the debug console instead of WebMaster mode? I never use it, so I am wondering what feature I am missing ....

-------

----
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #8  
Old 11-17-2010, 08:10 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,040
 

Default Re: Show debug console for certain IP's only

I think the issue is in both. It is almost the same but the debug console will not underline everything on the page so the page looks normal and you can browse and click without worrying the edit window will popup and you cannot messup anything
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
gb2world (11-17-2010)
  #9  
Old 11-17-2010, 09:51 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Show debug console for certain IP's only

I'm not able to verify that webmaster mode opens for anything other than the session you are in when you call it. (I didn't check many versions) My habit has always been to open webmaster mode in FF, and at the same time have another browser, like a less forgiving IE7, open at the same time to look at changes. I've never seen this problem over the years and versions, so I don't believe it happens with webmaster mode.

The debug console option, on the other hand, has the issue you report. That is one of the reasons I never check that box.

I understand now why you want the debug console to work properly and not simply use webmaster mode. So it is like webmaster mode except no identification of language variables and no mouse-over/border effects for template tracing? I don't use webmaster mode for editing anything - but I am so used to how it is, that the language variable links and other stuff don't phase me. Thanks for the information.


----
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #10  
Old 11-18-2010, 07:44 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,040
 

Default Re: Show debug console for certain IP's only

Maybe WM mode doesn;t do it - I just don't use it as I have pretty good understanding what's where in xcart template system. I was just suprised that something called "debug console" is visible to all when turned on
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:40 PM.

   

 
X-Cart forums © 2001-2020