<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Funzioni per verifica validità carte di credito]]></title><description><![CDATA[<p dir="auto">Ciao a tutti, nel norum ho trovato i seguemti scripts. qualcuno mi sa dire come applicarli?</p>
<p dir="auto">io ho una pagina con un modulo ed ho i seguenti campi:</p>
<ul>
<li>Tipo carta = cctype</li>
<li>Numero Carta = ccnumber</li>
<li>Cod. di Controllo = cvc_code</li>
</ul>
<p dir="auto">l'ho messo on-line ma credo che non ha i controlli dovuti, ovvero non da il minimo avviso. cosa sbaglio?</p>
<p dir="auto">&lt;%<br />
Function ValidCcNumber(ccnumber)<br />
ccnumber = cleanccnum(ccnumber)<br />
If ccnumber = "" then<br />
validccnumber = false<br />
Else<br />
iseven = false<br />
digits = ""<br />
For i = len(ccnumber) to 1 step -1<br />
If iseven then<br />
digits = digits &amp; cint(mid(ccnumber, i, 1))*2<br />
Else<br />
digits = digits &amp; cint(mid(ccnumber,i,1))<br />
End if<br />
iseven= (not iseven)<br />
Next<br />
checksum = 0<br />
For i = 1 to len(digits) Step 1<br />
checksum = checksum + cint(mid(digits, i, 1))<br />
Next<br />
validccnumber = ((checksum mod 10)=0)<br />
End if<br />
End function<br />
%&gt;<br />
&lt;%<br />
Function ValidCcType(ccnumber,cctype)<br />
ValidCcType = true<br />
If cctype = "Visa" then<br />
If CInt(cleanccnum(Left(ccnumber,1))) &lt;&gt; 4 then ValidCcType = false<br />
Elseif cctype = "MasterCard" then<br />
If not (CInt(cleanccnum(Left(ccnumber,2))) &gt; 50 and CInt(cleanccnum(Left(ccnumber,2))) &lt; 56) then ValidCcType = false</p>
<pre><code>Elseif cctype = "AmericanExpress" then
    If not CInt(cleanccnum(Left(ccnumber,2))) = 34 and not CInt(cleanccnum(Left(ccnumber,2))) = 37 then ValidCcType = false
Elseif cctype = "DinersClubCarteBlanche" then
    If not (CInt(cleanccnum(Left(ccnumber,3))) &gt; 299 and CInt(cleanccnum(Left(ccnumber,3))) &lt; 306) and not CInt(cleanccnum(Left(ccnumber,2))) = 37 and not CInt(cleanccnum(Left(ccnumber,2))) = 36 and not CInt(cleanccnum(Left(ccnumber,2))) = 38 then ValidCcType = false
Elseif cctype = "Discover" then
    If not CInt(cleanccnum(Left(ccnumber,2))) = 6011 then ValidCcType = false
End if
</code></pre>
<p dir="auto">End function<br />
%&gt;<br />
&lt;%<br />
Function ValidCcLength(ccnumber,cctype)<br />
ValidCcLength = true<br />
If cctype = "Visa" then<br />
If Len(ccnumber) &lt;&gt; 16 and Len(ccnumber) &lt;&gt; 13 then ValidCcLength = false<br />
Elseif cctype = "MasterCard" then<br />
If Len(ccnumber) &lt;&gt; 16 then ValidCcLength = false<br />
Elseif cctype = "AmericanExpress" then<br />
If Len(ccnumber) &lt;&gt; 15 then ValidCcLength = false<br />
Elseif cctype = "DinersClubCarteBlanche" then<br />
If Len(ccnumber) &lt;&gt; 14 then ValidCcLength = false<br />
Elseif cctype = "Discover" then<br />
If Len(ccnumber) &lt;&gt; 16 then ValidCcLength = false<br />
End if<br />
End function<br />
%&gt;<br />
&lt;%<br />
Function ValidCvcLength(cvc_code,cctype)<br />
ValidCvcLength = true<br />
If cctype = "Visa" then<br />
If Len(cvc_code) &lt;&gt; 3 then ValidCvcLength = false<br />
Elseif cctype = "MasterCard" then<br />
If Len(cvc_code) &lt;&gt; 3 then ValidCvcLength = false<br />
Elseif cctype = "AmericanExpress" then<br />
If Len(cvc_code) &lt;&gt; 4 then ValidCvcLength = false<br />
Elseif cctype = "DinersClubCarteBlanche" then<br />
If Len(cvc_code) &lt;&gt; 3 then ValidCvcLength = false<br />
Elseif cctype = "Discover" then<br />
If Len(cvc_code) &lt;&gt; 3 then ValidCvcLength = false<br />
End if<br />
End function<br />
%&gt;<br />
&lt;%<br />
Function cleanccnum(ccnumber)<br />
For i = 1 to len(ccnumber)<br />
If isnumeric (mid(ccnumber, i, 1)) then<br />
cleanccnum = cleanccnum &amp; mid(ccnumber, i,1)<br />
End if<br />
Next<br />
End function<br />
%&gt;</p>
<p dir="auto">Grazie</p>
]]></description><link>https://dev.connect.gt/topic/186054/funzioni-per-verifica-validità-carte-di-credito</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 12:34:44 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/186054.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Mar 2013 04:58:47 GMT</pubDate><ttl>60</ttl></channel></rss>