Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

mike240se

Archived
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Real Name
    Mike

mike240se's Achievements

  1. OK i realized the problem. so dumb on my part, i thought as long as the first 4 were ok, i could change the other numbers around. didnt realize there was a formula to make sure a card number was valid. i used a valid expired card i have and it worked. the only thing is, even though i put an email in the module, it didnt email the middle digits to that address. now i assume it would be crazy to use this module without SSL right? would i need a shared or private ssl? i have hostgator, i think they offer a shared ssl which they say is used to take cc purchases. so would that work?
  2. EDIT: i just realized that the error about the first 4 numbers only comes up when i put the card number in with too many digits. if i put a real card number in, with the correct digits, it says "The credit card number entered is invalid.<br>Please check the number and try again." also i was able to just remove the <br>'s from the error by editing includes/languages/english.php Help BB Code Help Help Toggle Side Panel
  3. its 2.2-ms2 and the file contents are: <?php /* $Id: cc_validation.php,v 1.3 2003/02/12 20:43:41 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Released under the GNU General Public License */ class cc_validation { var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year; function validate($number, $expiry_m, $expiry_y) { $this->cc_number = ereg_replace('[^0-9]', '', $number); if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) { $this->cc_type = 'Visa'; } elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) { $this->cc_type = 'Master Card'; } elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) { $this->cc_type = 'American Express'; } elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) { $this->cc_type = 'Diners Club'; } elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) { $this->cc_type = 'Discover'; } elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) { $this->cc_type = 'JCB'; } elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) { $this->cc_type = 'Australian BankCard'; } else { return -1; } if (is_numeric($expiry_m) && ($expiry_m > 0) && ($expiry_m < 13)) { $this->cc_expiry_month = $expiry_m; } else { return -2; } $current_year = date('Y'); $expiry_y = substr($current_year, 0, 2) . $expiry_y; if (is_numeric($expiry_y) && ($expiry_y >= $current_year) && ($expiry_y <= ($current_year + 10))) { $this->cc_expiry_year = $expiry_y; } else { return -3; } if ($expiry_y == $current_year) { if ($expiry_m < date('n')) { return -4; } } return $this->is_valid(); } function is_valid() { $cardNumber = strrev($this->cc_number); $numSum = 0; for ($i=0; $i<strlen($cardNumber); $i++) { $currentNum = substr($cardNumber, $i, 1); // Double every second digit if ($i % 2 == 1) { $currentNum *= 2; } // Add digits of 2-digit numbers together if ($currentNum > 9) { $firstNum = $currentNum % 10; $secondNum = ($currentNum - $firstNum) / 10; $currentNum = $firstNum + $secondNum; } $numSum += $currentNum; } // If the total has no remainder it's OK return ($numSum % 10 == 0); } } ?> i tried a legit MC and a legit Amex number to test and they didnt work. (just changed a couple of the middle numbers) but left the first 4 the same, but it says the first 4 are no good you are using this CC module? everyone is saying how bad it is to use it.... EDIT: i just realized that the error about the first 4 numbers only comes up when i put the card number in with too many digits. if i put a real card number in, with the correct digits, it says "The credit card number entered is invalid.<br>Please check the number and try again." also i was able to just remove the <br>'s from the error by editing includes/languages/english.php
  4. i didnt miss it, its just that it doesnt work. i always get the error: The first four digits of the number entered are: 5231<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again. I have been using real numbers and they dont work. plus i dont know why i am getting that <br> in there.
  5. I would like to do the same thing. We have a credit card terminal, and all our customers pick up their items. but we would like to be able to get their payment info online. the built in system does not work i guess? i thought the idea of storing part of the card in the DB and part sent in email would not be bad. We would delete the card info from the databsae as soon as the card was processed. if the built in system is no good for that, is there some way for us to do this? basically the requirement is to use our credit card machine. that is the only requirement.
×
×
  • Create New...