westminster86 Posted April 8, 2008 Share Posted April 8, 2008 I just came across the mod 10 algorithm for validating a credit card number, and while it seems to work, its somewhat outdated. Anyone know of any algorithms I good use to validate my credit card form. Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/ Share on other sites More sharing options...
redarrow Posted April 8, 2008 Share Posted April 8, 2008 You dont valadate a credit card unless you own a bank, or have the abilty off using the banks gateway to valadate the users deatail.... the only method i no is to use preg_match to valadate the numbers are the numbers correct number format from there card provider............ that why we all use paypal or another credit card gateway......... Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-511955 Share on other sites More sharing options...
westminster86 Posted April 8, 2008 Author Share Posted April 8, 2008 The thing is im not actually selling the products. Its a project im doing for my final year. I have products that a user can to the shopping cart and when he/she goes to checkout it asks for their credit card details. I just want to validate the the users input. Can i still do this with paypal? Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-511966 Share on other sites More sharing options...
KevinM1 Posted April 8, 2008 Share Posted April 8, 2008 The thing is im not actually selling the products. Its a project im doing for my final year. I have products that a user can to the shopping cart and when he/she goes to checkout it asks for their credit card details. I just want to validate the the users input. Can i still do this with paypal? Since it's for a project, like the last person said, just use regular expressions. There's most likely no need to do more than ensure that the credit card info is in the right format. Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-511967 Share on other sites More sharing options...
westminster86 Posted April 8, 2008 Author Share Posted April 8, 2008 So you wouldnt suggest using an algorithm of some sort but to use the preg_match instead? Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512010 Share on other sites More sharing options...
KevinM1 Posted April 8, 2008 Share Posted April 8, 2008 So you wouldnt suggest using an algorithm of some sort but to use the preg_match instead? Yup, as it's the easiest way to do it. Why go through all the trouble if you're not actually processing the card? Unless specifically told to go the extra mile, just ensure that there's 16 digits for the card number. Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512027 Share on other sites More sharing options...
discomatt Posted April 8, 2008 Share Posted April 8, 2008 The regex is an algorithm. An algorithm is simply a set of instructions to follow to turn a problem into a solution. I'm not sure what sort of algorithm you'd use beyond making sure the input appears valid anyways Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512033 Share on other sites More sharing options...
KevinM1 Posted April 8, 2008 Share Posted April 8, 2008 The regex is an algorithm. An algorithm is simply a set of instructions to follow to turn a problem into a solution. I'm not sure what sort of algorithm you'd use beyond making sure the input appears valid anyways Good point. Regular expressions are really just pattern matching algorithms with unique (funky?) syntax. It's a powerful tool to deal with validating all kinds of input. Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512043 Share on other sites More sharing options...
westminster86 Posted April 8, 2008 Author Share Posted April 8, 2008 One last thing. I know its not ideal to store the these sensitive details in a database, but for my project im going to have to. Before storing the details im going to encrypt them. Ive only ever used the crypt fucntion to encrypt password fields. Would it be suitable to use this function for the credit card details? Is there a better option, is MD5 more appropriate? Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512060 Share on other sites More sharing options...
quiettech Posted April 8, 2008 Share Posted April 8, 2008 The thing is im not actually selling the products. Its a project im doing for my final year. I have products that a user can to the shopping cart and when he/she goes to checkout it asks for their credit card details. I just want to validate the the users input. Can i still do this with paypal? The mod10 method will be more than enough for this particular purpose. The actual validation can then be left to whatever mechanism is in place for communicating with the online store banking services. There's heaps of php scripts doing credit card validation on the web. Just search google for "creadit card validation php" (124,000 results). You can take a good look at a few of them and learn other issues like lenght, initial digit(s) and even where the control digit may be. EDIT: regarding your last question... Let's get something straight here. You are playing with fire. You shouldn't store credit card information on the database. If you do, you must inform the users you are doing that and you better make sure you are complying with your country privacy and data storing (or whatever it is called) laws. You will be in a whole world of ... if you are not doing these two things. So, since this is just a project, how about not storing that data? Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-512061 Share on other sites More sharing options...
ginfeedax Posted December 29, 2008 Share Posted December 29, 2008 HEEELLLP DUDE!! Can somebody help me to find an reliable but easy php credit card validation class script???? i badly need it please..... Quote Link to comment https://forums.phpfreaks.com/topic/100130-creating-a-credit-card-validation-class-with-php/#findComment-725419 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.