Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 14-08-2005, 11:31 PM   #1 (permalink)
In The Zone
 
Thor's Avatar
 
Join Date: Jun 2004
Location: Kolkata
Posts: 384
Default Determine if a credit card number is valid using VB6


Quote:
Takeaway:
If you support a Web site that accepts online payments, the first step in any process that accepts credit card numbers should be verifying the number. This tip shows how to do this using VB6.



Credit card numbers are not assigned at random. Each number, usually 16 digits long, must adhere to certain mathematical conditions to be valid. This is called the Luhn Check, and it is used by almost all major cards. If you support a Web site that accepts online payments, the first step in any process that accepts credit card numbers should be verifying the number. This tip shows how you can do this using VB6.

Using VB6, the credit card number is passed, as a string, to the function CCNumberValid. The string must contain only digits—no embedded spaces or dashes. The function returns True if the number is valid and False if not.

Public Function CCNumberValid(ByValCCNumber As String) As Boolean



Dim Result As Long

Dim Total As Long

Dim idx As Integer

Dim i As Integer

Dim j As Integer



j = 1

For i = Len(CCNumber) To 1 Step -1

Result = (CInt(Mid$(CCNumber, i, 1)) * j)



If Result >= 10 Then

Total = Total + (CInt(Mid$(CStr(Result), 1, 1)) _

+ CInt(Mid$(CStr(Result), 2, 1)))

Else

Total = Total + Result

End If



If j = 2 Then j = 1 Else j = 2

Next



If Total Mod 10 = 0 Then

CCNumberValid = True

Else

CCNumberValid = False

End If


End Function


The fact that a credit card number is valid does not mean that it is actually assigned to an account or that the account is in good standing. But checking the validity of a number is the best and fastest way to weed out errors in number entry.
Courtesy : Techrepublic Newsletter.

Or See Link at : www.snipurl.com/ccheck
__________________
Beware of my Wrath Mortals, Thou hast no choice.
Thor is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 15-08-2005, 01:03 AM   #2 (permalink)
I am Optimus Prime
 
navjotjsingh's Avatar
 
Join Date: Feb 2005
Location: Delhi, India
Posts: 1,919
Default

Script shows error at Line 1 Char 45.
navjotjsingh is offline  
Old 15-08-2005, 01:18 AM   #3 (permalink)
In The Zone
 
Join Date: Feb 2004
Location: Pearl City, Hyderabad.
Posts: 346
Default

@Thor: I too got the same error Line 1 char 45

Plz post the link from TechRepublic so we can try using tat.
__________________
RajŪ Anyone else is not me...!!!
rajas is offline  
Old 15-08-2005, 01:30 AM   #4 (permalink)
The No.1 Stupid
 
~Phenom~'s Avatar
 
Join Date: May 2005
Location: CYBERYARD
Posts: 1,708
Default

same problem here. gimme link to source.
__________________
n00b forever...
~Phenom~ is offline  
Old 15-08-2005, 11:46 AM   #5 (permalink)
In The Zone
 
Thor's Avatar
 
Join Date: Jun 2004
Location: Kolkata
Posts: 384
Default

Ok. Link Posted with Original Post. Sorry 4 thy Inconvenience.
__________________
Beware of my Wrath Mortals, Thou hast no choice.
Thor is offline  
Old 15-08-2005, 06:49 PM   #6 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default

Thnx a lot, now i know how to evade CC checks...
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by abhidev
- by Sujeet
- by Sarath
- by Krow

Advertisement




All times are GMT +5.5. The time now is 08:39 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2