Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove admin login sequence


martinstan

Recommended Posts

Posted

Hi

I've searched high and low but can't seem to find an answer to this so would appreciate some help.

 

On a recent installation I've noticed that there is now a built in login to the admin area. I used to just password protect the admin folder through my hosting company which is the method I prefer. Is there a way to disable the built in setup?

 

Many thanks

Martin

  • 1 year later...
Posted

I understand that this topic is around 2 years old, but since I found it via Google and we're still using osC, I thought I'd post a different solution that some might find helpful.

 

In our case, we have password-protected our entire admin folder using .htaccess and required SSL. This is far more secure than the built-in osCommerce authentication and is highly recommended rather than relying on that. Because of this, the osC auth was redundant and often broke modules for us, and we wanted to truly remove it. The solution above does not remove the authentication. It attempts to get osCommerce to bypass it autmoatically for you by scripting a login sequence using the existing credentials.

 

If you look at the github link (and you can read PHP code), you'll see that this solution involves dancing around an if block in the application_top file that actually requests the authentication. If you simply delete or comment out that entire if-block, however, the authentication is truly removed. Please be aware that if you do this, you will be removing a layer of security from your admin panel, and you should have something already in place (like the .htaccess method I mentioned) before you attempt this!

 

In layman's terms, the solution is this:

  1. Open up the file /catalog/admin/includes/application_top.php (using some combination of an FTP program and file editor, or the default file editor on your web host).
  2. Scroll down to around line 133 (this is approximate and depends on modifications to your code as well as osC version), where you should see this line:
    if (!tep_session_is_registered('admin')) {


  3. That is the beginning of the if block you need to get rid of. If you have a nice enough PHP editor, it will highlight the closing bracket for you. If you don't, it should run down to the curly brace ( } ) following the line reading
    unset($redirect);

    approx. 20 lines later.

  4. You can delete this code (make sure you have a backup in case this doesn't work for you!), but an even safer way is to simply comment it out using PHP multiline comments. /* This is how you demarcate a multiline PHP comment. */ Remember that everything between those markings are ignored, so make sure you only comment out the code you don't want!

To sum up, you should start with a code block like this:

 

if (!tep_session_is_registered('admin')) {
...
...
...
unset($redirect);
}

 

and end up like this:

 

/* if (!tep_session_is_registered('admin')) {
...
...
...
unset($redirect);
} */

 

Hope that helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...