Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Blacklist


Jack_mcs

Recommended Posts

The code change should probably be made in create_account.php and/or checkout_process.php, depending on the ban level. In the checkout_process.php, where there is code like this

if ($blacklisted['entry_street_address'] === $order->delivery['street_address'] &&

it would need to be changed to something that would check the various parts. For example (this is just being typed here and may not work)

$streetBL = explode($blacklisted' ',['entry_street_address']);
$street = expload(' ', $order->delivery['street_address']);
$notBL = false;
for ($i - 0; $i < count($streetBL); ++$i)
{
if (strpos($streetBL[$i], $street[$i]) === FALSE)  //no match was found 
{
  $notBL = true;			
  break;
}
}

if ($notBL)
echo 'This customer is OK';
else
echo 'This customer should be blacklisted.';

The other parts would have to be checked too.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

here is what i tried:

$streetBL = explode($blacklisted['entry_street_address']);

$street = explode(' ', $order->delivery['street_address']);

$notBL = false;

for ($i - 0; $i < count($streetBL); ++$i)

{

if (strpos($streetBL[$i], $street[$i]) === FALSE) //no match was found

{

$notBL = true;

break;

}

}

 

if ($notBL){

#this customer is OK

}else{

tep_redirect(index.php);

break;

}

it seemed to work, but it interpreted everyone as blacklisted. can you spot my errors?

 

(i was getting an error for:

$streetBL = explode($blacklisted' ',['entry_street_address']);

..so i moved things around. not sure if my edits there is what may have messed it up.)

Link to comment
Share on other sites

still interpreting everybody as blacklisted. any other bugs?:

$streetBL = explode("",$blacklisted['entry_street_address']);
$street = explode(' ', $order->delivery['street_address']);
$notBL = false;
for ($i - 0; $i < count($streetBL); ++$i)
{
if (strpos($streetBL[$i], $street[$i]) === FALSE) //no match was found
{
$notBL = true;
break;
}
}

if ($notBL){
#this customer is OK
}else{
tep_redirect(index.php);
break;
}

Link to comment
Share on other sites

You will have to print out each result in the loop to see why it is failing. The code will most liekly not work correctly as it is anyway though since it is assuming the addresses contain the same number of items, which they won't in every case. So one address might 123 Apple and another might be 234 Pear Apt C.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 years later...

Hi, i know this thread is old.

 

How can I input a search-function into the blacklist, that allows me to search a customer in the shop.

My plan: I whrite a Lastname into a textfield, after I klicked a button, the names listed in the dropdown menü.

 

is it possible?

Link to comment
Share on other sites

I don't understand what it is you are asking for. There is already a list of names in the Blacklist section in admin. Is that not what you want?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I know, sure i want this

 

but I need a searchfunction for customers, i want to insert an extra field into the blacklist like a textfield or simething, that searching for customer wich I wrote in this textfield, and show him in the Drop down menu.

 

sry for that english ._.

Link to comment
Share on other sites

I'm sorry but I'm still not following. But it doesn't matter since what you are asking for is new code, which I don't provide in support threads due to the amount of time it would take.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 1 year later...

Hi Jack!

 

Installed your contrib as it looks very useful. Didn't know if I missed a lang file or update? I checked in your admin/incl/lang/eng/blacklist.php and couldn't find theme.

 

(In the Admin Blacklist Controllers Screen) all language is defined correctly except:

 

TEXT_INFO_DATE_BAN05/18/2011

 

TEXT_INFO_DATE_BAN_MEMBER

 

 

Thanks Jack, hope all has been going well w you and your family :)

 

KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

*Plus*

1) Any reason why I have a name on the banned list twice? I looked and the customer only has one acct setup.

2) (in the Banned customer right side box) "Attempted Use: (If checked, trying to connect)" does not seem to work for me. If checked it won't stay. Also shouldn't this be on the other side when you create the banned person. (ie) you may only want to be notified if the person tries to login but not ban him?

 

I edited the lang file to define the above...

TEXT_INFO_DATE_BAN05/18/2011

TEXT_INFO_DATE_BAN_MEMBER

 

define('TEXT_INFO_DATE_BAN', 'Date: ');

define('TEXT_INFO_DATE_BAN_MEMBER', 'Date Banned: ');

 

^^ But not sure on you verbiage you wanted ^^

Thanks Jack :)

Edited by Top_Speed

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

*Plus*

1) Any reason why I have a name on the banned list twice? I looked and the customer only has one acct setup.

2) (in the Banned customer right side box) "Attempted Use: (If checked, trying to connect)" does not seem to work for me. If checked it won't stay. Also shouldn't this be on the other side when you create the banned person. (ie) you may only want to be notified if the person tries to login but not ban him?

 

I edited the lang file to define the above...

TEXT_INFO_DATE_BAN05/18/2011

TEXT_INFO_DATE_BAN_MEMBER

 

define('TEXT_INFO_DATE_BAN', 'Date: ');

define('TEXT_INFO_DATE_BAN_MEMBER', 'Date Banned: ');

 

^^ But not sure on you verbiage you wanted ^^

Thanks Jack :)

I haven't upgraded this conribution is six years so there are problably problems such as you found. It still works though and I do have plans to upgrade it but I can't seem to find the time for it rihgt now.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 4 years later...

 

 

1) Any reason why I have a name on the banned list twice? I looked and the customer only has one acct setup.

 

I've recently installed this in my 2.3.1, and also noticed the multiple appearances of the same name.  It's because of multiple address book entries for the customer.  It really threw me at first, because I'd entered some customers' addresses as my own for testing.  I couldn't figure out where it was getting them, until I looked closer.

 

I know the thread is old, but someone (such as myself) may also run into this.

Link to comment
Share on other sites

Thanks for posting that. Yes, the entries from the address book table are added to the ban list and that would generate duplicate names. There probably should be something added to show they are different addresses for the same person.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 1 year later...

A new version has been uploaded with these changes:

  •  
  • Now compatible with all 2.3 shops.
  • Changed many aspects of the GUI.
  • Fixed a problem where customers with three or more names failed.
  • Fixed problem where comments would not show up when blacklisting a customer if he were the frist customer.
  • Added Index to SQL table.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@Jack_mcs

 

Just got the new version up and running and 3+ part names works beautifully.  I have one minor(?) problem:  Once you add someone to the ban list, their name no longer appears in the "all customers" list.

 

If I blacklist, but do not ban completely, and later decide to ban completely, I have to remove them from the 'blacklist' before I can edit their status.  

 

I changed the query from :

 

  $customers_query = tep_db_query("SELECT customers_id, customers_lastname FROM customers where customers_id NOT IN (select customers_id from blacklist) ORDER by " . $sort_order . " ASC");
 
to:
 
  $customers_query = tep_db_query("SELECT customers_id, customers_lastname FROM customers ORDER by " . $sort_order . " ASC");
 
It appears to work this way, but I wanted to make sure this wouldn't cause a problem I'm not immediately seeing...?
 
Link to comment
Share on other sites

That is the correct change for what you want. It was that way in the last version but I added the code to only load those not in the blacklist since I thought it would be less confusing. If you see a name in the customer list and thought you had blacklisted that customer, you may need to look at the blacklist to be sure you did. 

 

A better way to go might be to leave the blacklisted customers in the customers list but highlight them to show they have been blacklisted. But that is not a quick change so maybe I'll add it in the next version.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 3 years later...

A new version has been uploaded with these changes:

  • Changed the code to work with Phoenix.
  • Changed the code to install into Frozen without any code changes required.
  • Replaced the GUI in admin. Provided by member @Demitry.
  • Removed code for pre-Frozen versions.

My thanks to Demitry for the rewritten gui in admin.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 years later...

Hi Jack,

Recently had an issue where a banned customer came back and created a new account with a different email (he'd made no attempt to login with his original email recently), and used the same address as he'd used before.  Originally though, his city entry used all caps.  When he created the new account, only the first letter of the city was cap'd, so his street address was not 'strictly' the same.  There was no email sent to notify that an order on the new account had occurred.  Am I correct in assuming the difference in caps usage is why?  I noticed this in the code of checkout_process.php: 


$blacklisted['entry_street_address'] === $order->delivery['street_address']  

 

Would changing the "===" to "==" solve the issue, or would the address string require 'scrubbing' or normalization before comparison?  Please forgive my ignorance, I know just enough to be dangerous, heh.

Edited by Supertex
changed 'street address' to 'city'
Link to comment
Share on other sites

@SupertexThanks for  posting this. I haven't looked at that in years and no one has ever mentioned it before. The === won't do a proper comparison. To fix this, change this code

      if ($blacklisted['entry_street_address'] === $order->delivery['street_address'] && 
          $blacklisted['entry_suburb']         === $order->delivery['suburb'] && 
          $blacklisted['entry_city']           === $order->delivery['city'] && 
          $blacklisted['entry_postcode']       === $order->delivery['postcode'] && 
          $blacklisted['entry_state']          === $order->delivery['state'])
      { 

to

      if (strcasecmp($blacklisted['entry_street_address']. $order->delivery['street_address']) && 
          strcasecmp($blacklisted['entry_suburb'], $order->delivery['suburb']) && 
          strcasecmp($blacklisted['entry_city'], $order->delivery['city']) && 
          strcasecmp($blacklisted['entry_postcode'], $order->delivery['postcode']) && 
          strcasecmp($blacklisted['entry_state'], $order->delivery['state']))
      { 

 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

BTW...I assume it wouldn't be too complicated to add some code in the create_account.php that would look for name, phone, and make that same comparison on address book entries?

Link to comment
Share on other sites

That seems to have broken it.  Im seeing this in the error log:

[26-Mar-2022 20:53:45 America/Chicago] PHP Warning:  strcasecmp() expects exactly 2 parameters, 1 given in /home/public_html/checkout_process.php on line 363

 

Edit: NVM...found it.  There was a period between the street address comparisons...I just copy/pasted from your post.  It works :D
 

Edited by Supertex
Link to comment
Share on other sites

Well...thought it worked, but it was sending the email for every transaction.  Did a little digging, and it appears that strcasecmp returns zero or non-zero, rather than true of false.  This made it work, as far as I can tell:

 

       if ((strcasecmp($blacklisted['entry_street_address'], $order->delivery['street_address'])== 0) && 
          (strcasecmp($blacklisted['entry_suburb'], $order->delivery['suburb'])== 0) && 
          (strcasecmp($blacklisted['entry_city'], $order->delivery['city'])== 0) && 
          (strcasecmp($blacklisted['entry_postcode'], $order->delivery['postcode'])== 0) && 
          (strcasecmp($blacklisted['entry_state'], $order->delivery['state'])== 0))
      { 

 

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