Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Admin Change Customer Passwords


kymation

Recommended Posts

This contribution allows you to change a customer's password from your Admin.

 

I noticed there isn't a support thread for this one, so here it is.

 

I'll post version 3.0 in a minute. I've updated the code to fix a couple of bugs, including a global variable conflict with 2.2rc1. I've also added an automatic password generator and a button to use this function from the existing Customers page. The whole thing could probably be integrated into the Customers page, but I'm not going there. Feel free if you want to.

 

This version could also use some help with translations. If you can do one, please upload a complete copy to the Contributions page.

 

The contribution can be found here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim,

 

In the Readme file on step 8, it refers to the file:

 

catalog/admin/includes/customers.php

 

And lists some changed which need to be made. I don't seem to have that file present!

 

Am I missing something?

It is part of the stock osc install.

Link to comment
Share on other sites

Very nice update, Jim. It's much better now. Thank you for your contribution! :thumbsup:

 

I noticed just a little bug:

 

When I'm on the customer's page and click the Change Password button, when it takes me to the change password page, on the search field it's writen WHERE customers_id='43', when it should be the customer's name (or nothing at all). I'm no programmer, so I don't know how to fix it. Hope you can. :blush:

Patty

Link to comment
Share on other sites

I've installed your contrib just this minute and get an error when clicking on "change password":

 

Fatal error: Call to undefined function: tep_hide_session_id() in /home/content/n/o/t/nothingsuper99/html/_domains/bienenshop24.de/admin/change_password.php on line 117

 

Any hints?

Link to comment
Share on other sites

I've installed your contrib just this minute and get an error when clicking on "change password":

 

Fatal error: Call to undefined function: tep_hide_session_id() in /home/content/n/o/t/nothingsuper99/html/_domains/bienenshop24.de/admin/change_password.php on line 117

 

Any hints?

Install the previous version.

Link to comment
Share on other sites

Patty: Thanks for the bug report. Looks like I goofed somewhere. I'll go find that and fix it.

 

tfrischholz: tep_hide_session_id() is a part of stock osCommerce 2.2rc1. If you haven't patched your store to the latest version, you might want to consider doing so. I would advise adding the security patches at the very least. If you don't do that, you can add this function to the bottom of admin/includes/functions/html_output.php (Just before the final ?>):

////
// Hide form elements
 function tep_hide_session_id() {
$string = '';

if (defined('SID') && tep_not_null(SID)) {
  $string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
}

return $string;
 }

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Very nice update, Jim. It's much better now. Thank you for your contribution! :thumbsup:

 

I noticed just a little bug:

 

When I'm on the customer's page and click the Change Password button, when it takes me to the change password page, on the search field it's writen WHERE customers_id='43', when it should be the customer's name (or nothing at all). I'm no programmer, so I don't know how to fix it. Hope you can. :blush:

I've been looking at this and I can't see where this could be happening. From what you're saying, it's inserting the search string where it should be the customer's name and email. I can't reproduce this, and I can't see it in the code. The only thing I can suggest is that you upload a fresh copy of admin/change_password.php, in case it got corrupted. If this continues to happen with a fresh install, I admit to being stumped.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hey, Jim. Tks for looking into this.

 

It only happens when I click the change password button directly from the customer's page (where the other buttons are: edit, remove, etc).

If I go there from the admin menu, it shows the search field blank. I've tried with IE6 and FF2.0.

 

It's not a big deal, I still can change the password. It's just annoying because it shouldn't be there... hehe

Hope you can find it.

 

Tks for your attention anyway.

Patty

Link to comment
Share on other sites

I can roger Patty's discovery - I have the same "issue".

 

@kymation: I rather stick with the html_output.php solution instead of trying to patch my store. I don't know my exact version number plus it got so heavily modified that just the thought of patching it scares the hell out of me...

Link to comment
Share on other sites

I can roger Patty's discovery - I have the same "issue".

 

@kymation: I rather stick with the html_output.php solution instead of trying to patch my store. I don't know my exact version number plus it got so heavily modified that just the thought of patching it scares the hell out of me...

I still can't reproduce this, so I'd really appreciate some help from those of you who are seeing this. I think it's a global variable problem. If you can, please make this change and let me know if it works. If it does I'll post a revised file with the fix.

 

In admin/change_password.php, change all instances of $search to $search_string. You will find this on lines 64, 67, 71, and 83.

 

Tobias: I understand your reluctance to update your site. I had to patch five heavily-modified stores to 2.2rc1. It wasn't pretty. If you want to know the version of your original code, you probably have something like this in catalog/includes/application_top.php:

// define the project version
 define('PROJECT_VERSION', 'osCommerce Online Merchant v2.2 RC1');

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Perfect, Jim! It worked!! Tks a lot! :thumbsup:

Thank you for testing this for me. I'll post a new version with the fix in a minute.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Version 3.1 is now up. If you already have this installed, just replace admin/change_password.php with the one in the distribution, or make the changes I posted above.

 

If you find any more bugs, or have a problem with this code, please post 'em here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I have MS2. So where could I get those patches to RC1.

Would it just mean executing those patches and crossing the fingers?

You can get the patches in the osCommerce 2.2rc1 distribution (Solutions > Downloads in the bar at the top of the page.) Patches will need to be done manually. If you have not modified a given file then it can simply be replaced with the new one. Modified files will need to be patched by hand. Instructions are in the distribution. It's pretty much like adding a large Contribution.

 

If you have the original MS2, then you have three sets of patches to apply: 051113, 060817, and rc1 (in that order.) I recommend doing each group of patches separately and testing carefully after each patch. Some of the patches may cause conflicts with some of your changes, so testing is essential.

 

I don't want to scare you off, but it is a lot of work.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

QUOTE(Chris Perkins @ Dec 1 2007, 10:51 PM) *

Jim,

 

In the Readme file on step 8, it refers to the file:

 

catalog/admin/includes/customers.php

 

And lists some changed which need to be made. I don't seem to have that file present!

 

Am I missing something?

 

It is part of the stock osc install.

 

 

It is part of the stock osc install.

 

 

Not in 2.2MS2 it's not ! that line should read "catalog/admin/customers.php" it's in the admin root and not in the /includes.

 

Also for 2.2 the post method doesn't work and there's a couple of other bugs in the code that make it not 2.2 friendly.

 

I'll clean it up in a minute and post a working 2.2ms2 version.

 

Courty

Link to comment
Share on other sites

QUOTE(Chris Perkins @ Dec 1 2007, 10:51 PM) *

Jim,

 

In the Readme file on step 8, it refers to the file:

 

catalog/admin/includes/customers.php

 

And lists some changed which need to be made. I don't seem to have that file present!

 

Am I missing something?

 

It is part of the stock osc install.

Not in 2.2MS2 it's not ! that line should read "catalog/admin/customers.php" it's in the admin root and not in the /includes.

 

Also for 2.2 the post method doesn't work and there's a couple of other bugs in the code that make it not 2.2 friendly.

 

I'll clean it up in a minute and post a working 2.2ms2 version.

 

Courty

 

OK, had a look and I now have a 2.2MS2 version of change_password.php

 

Bit confused though, the main form as a POST and a GET ?! the GET for the search and the post for the change password script.. I know it doesn't matter that much but I changed the code it to listen for a POST.

 

I have also added error checking (Lines 3 and 4) which is good for debuging, take it out for live though.

 

My install would not work (totally blank screen) until I removed the ref to' tep_hide_session_id();' in the search code about half way down the file.

 

For info my install is Red Hat Linux, OSC 2.2MS2, PHP5, MySql5 and the new file works fine on this setup.. will post to contribs now

 

Courty

Link to comment
Share on other sites

I am getting the following error when i click on the change password link

 

Notice: Constant PAGE_PARSE_START_TIME already defined in C:\xampp\htdocs\oscommerce\catalog\admin\includes\application_top.php on line 14

 

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in C:\xampp\htdocs\oscommerce\catalog\admin\includes\functions\compatibility.php:18) in C:\xampp\htdocs\oscommerce\catalog\admin\includes\functions\compatibility.php on line 30

 

pls help

Link to comment
Share on other sites

I am getting the following error when i click on the change password link

pls help

That sort of error can happen when you put a file in the wrong place. Check that you didn't load a file from the catalog side into the admin, or that you didn't load a file into admin/includes/languages/english/ instead of into admin/. If all the files are in the correct places, check that you modified the correct files, and then check your mods carefully.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi, can anyone help me with this:

 

Notice: Constant PAGE_PARSE_START_TIME already defined in /opt/oscommerce/catalog/admin/includes/application_top.php on line 14

 

Fatal error: Cannot redeclare _sess_open() (previously declared in /opt/oscommerce/catalog/admin/includes/functions/sessions.php:18) in /opt/oscommerce/catalog/admin/includes/functions/sessions.php on line 18

 

 

I get this error when I click on the Change Password link in the admin panel.

 

Thanks

 

D.

Link to comment
Share on other sites

Hi, can anyone help me with this:

 

Notice: Constant PAGE_PARSE_START_TIME already defined in /opt/oscommerce/catalog/admin/includes/application_top.php on line 14

 

Fatal error: Cannot redeclare _sess_open() (previously declared in /opt/oscommerce/catalog/admin/includes/functions/sessions.php:18) in /opt/oscommerce/catalog/admin/includes/functions/sessions.php on line 18

I get this error when I click on the Change Password link in the admin panel.

 

Thanks

 

D.

See my comments in the post just above yours. Also, depending on what version of osCommerce you are using, you may need to make the changes to your original files instead of using the files supplied with this contribution.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

looks like a nice contribution, trying to get this working on a heavily modded osc install,

I click on the change password button and i get the following error:

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /home/xxxxxx/public_html/admin/includes/functions/password_funcs.php:16) in /home/xxxxxx/public_html/admin/includes/functions/password_funcs.php on line 16

 

which has stumped me because its saying that the same function is referred to twice by itself lol

 

any ideas ??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...