X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Show debug console for certain IP's only (https://forum.x-cart.com/showthread.php?t=56436)

cflsystems 11-06-2010 03:43 PM

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.

gb2world 11-06-2010 04:33 PM

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.

----

cflsystems 11-06-2010 08:33 PM

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.

amy2203 11-08-2010 03:54 AM

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.

cflsystems 11-08-2010 07:56 AM

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

amy2203 11-17-2010 03:44 AM

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

gb2world 11-17-2010 06:21 PM

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

-------

----

cflsystems 11-17-2010 08:10 PM

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

gb2world 11-17-2010 09:51 PM

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.


----

cflsystems 11-18-2010 07:44 AM

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


All times are GMT -8. The time now is 05:06 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.