Advertisement
Advertisement
| 02.26.2008 at 11:28AM PST, ID: 23194699 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: |
<%
'Credit card validation Function
Public Function ValidCard(ByVal CardNumber)
Dim intCount
Dim intValue
Dim intArr()
Dim intStart
Dim intArrValue
ValidCard = False
If Not IsNumeric(CardNumber) Then Exit Function
If Left(CardNumber, 4) = 2131 Or Left(CardNumber, 4) _
= 1800 Then
'JCB
If Len(CardNumber) <> 15 Then Exit Function
ElseIf Left(CardNumber, 4) = 2149 Or _
Left(CardNumber, 4) = 2014 Then
'enroute
If Len(CardNumber) = 15 Then
ValidCard = True
End If
Exit Function
ElseIf Left(CardNumber, 4) = 6011 Then
'discover
If Len(CardNumber) <> 16 Then Exit Function
ElseIf (Left(CardNumber, 3) >= 300 And _
Left(CardNumber, 3) <= 305) Or _
Left(CardNumber, 2) = 36 Or Left(CardNumber, 2) = 38 Then
'diners club
If Len(CardNumber) <> 14 Then Exit Function
ElseIf Left(CardNumber, 2) = 34 Or _
Left(CardNumber, 2) = 37 Then
'amex
If Len(CardNumber) <> 15 Then Exit Function
ElseIf Left(CardNumber, 2) >= 51 And _
Left(CardNumber, 2) <= 55 Then
'mastercard
If Len(CardNumber) <> 16 Then Exit Function
ElseIf Left(CardNumber, 1) = 4 Then
'visa
If Not (Len(CardNumber) = 13 Or Len(CardNumber) = 16) _
Then Exit Function
ElseIf Left(CardNumber, 1) = 3 Then
'jcb (2)
If Len(CardNumber) <> 16 Then Exit Function
Else
'unknown card.....
Exit Function
End If
ReDim intArr(Len(CardNumber))
For intCount = Len(CardNumber) - 1 To 1 Step -2
intValue = Mid(CardNumber, intCount, 1) * 2
intArr(intCount) = intValue
Next
intValue = 0
If Len(CardNumber) Mod 2 = 0 Then
intStart = 2
Else
intStart = 1
End If
For intCount = intStart To Len(CardNumber) Step 2
intValue = intValue + Mid(CardNumber, intCount, 1)
intArrValue = intArr(intCount - 1)
If intArrValue < 10 Then
intValue = intValue + intArrValue
Else
intValue = intValue + Left(intArrValue, 1) + _
Right(intArrValue, 1)
End If
Next
If intValue Mod 10 <> 0 Then
Exit Function
Else
ValidCard = True
End If
End Function
'************************************************************************************
'PASSWORD GENERATION SCRIPT - if allowNumbers:false then it will generate a password
'without numbers else it will generate only numeric password
Function generatePassword( allowNumbers )
NUMLOWER = 48 ' 48 = 0
NUMUPPER = 57 ' 57 = 9
LOWERBOUND = 65 ' 65 = A
UPPERBOUND = 90 ' 90 = Z
LOWERBOUND1 = 97 ' 97 = a
UPPERBOUND1 = 122 ' 122 = z
PASSWORD_LENGTH = 6
' initialize the random number generator
Randomize()
newPassword = ""
count = 0
DO UNTIL count = PASSWORD_LENGTH
If allowNumbers Then
pwd = Int( ( NUMUPPER - NUMLOWER ) * Rnd + NUMLOWER )
Else
' generate a num between 2 and 10 ;
' if num > 4 create an uppercase else create lowercase
If Int( ( 10 - 2 + 1 ) * Rnd + 2 ) > 4 Then
pwd = Int( ( UPPERBOUND - LOWERBOUND + 1 ) * Rnd + LOWERBOUND )
Else
pwd = Int( ( UPPERBOUND1 - LOWERBOUND1 + 1 ) * Rnd + LOWERBOUND1 )
End If
End If
newPassword = newPassword + Chr( pwd )
count = count + 1
Loop
generatePassword = newPassword
End Function
'**********************************************************************************
'function SendEmail(fto,ffrom,fsub,fbody)
'Dim ObjSendMail
'Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.domain.com"
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.domain.com.au"
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
' basic (clear-text) authentication
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="help@domain.com"
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") '="name"
' ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"
' ObjSendMail.Configuration.Fields.Update
'End remote SMTP server configuration section==
'\ This is to make sure all email sent from our accout have an Account Name. By defaula email id is used as account name, so we are showing it as Customer care GASP. This is is required because we may enable direct communication and in that case users actual email id and name will be used.
' If Trim(ffrom)="custcare@domain.com" Or Trim(ffrom)="help@domain.com" Then
' ffrom="Customer Care <custcare@domain.com>"
' End if
' ObjSendMail.To = fto
' ObjSendMail.From = ffrom
' ObjSendMail.Subject = fsub
' we are sending a text email.. simply switch the comments around to send an html email instead
' ObjSendMail.HTMLBody = fbody
'ObjSendMail.TextBody = "this is the body of the ASP test sending from testmail.asp"
' ObjSendMail.Send
' Set ObjSendMail = Nothing
'end Function
'******************************************************************************
function SendEmail(fto,ffrom,fsub,fbody,ind)
Set myMail=CreateObject("CDO.Message")
myMail.Subject=fsub
myMail.From=ffrom
myMail.To=fto
myMail.HTMLBody=fbody '\\ HTML emails
' myMail.TextBody=fbody '\\ Incase you need to send a text email
'\\ Configuration
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="relay-hosting.secureserver.net"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
End function
'************************************************************************************
'Send Mail Function with CDONT
'function SendEmail(fto,ffrom,fsub,fbody,findex)
' dim objSendMail
' set objSendMail=server.CreateObject("CDONTS.NewMail")
' With objSendMail
' .To=fto
' .From=ffrom
' .subject=fsub
' .body=fbody
' .MailFormat=findex
' .BodyFormat=findex
' .send
' End With
' set objSendMail=nothing
'end Function
'************************************************************************************
'Send Mail Function with CDO
function SendEmailCDO(fto,ffrom,fsub,fbody)
Const cdoBasic = 1 'Use basic (clear-text) authentication.
Const cdoSendUsingPort = 2
Dim ObjCDO
Dim iConf
Dim Flds
On Error Resume Next
'Create message and configuration objects
set ObjCDO = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
sMailServer="127.0.0.1"
'Appluy settings to the configuration object
With Flds
' Specify the authentication mechanism to basic (clear-text) authentication.
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
' The username for authenticating to an SMTP server
'.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "admin"
' The password used to authenticate to an SMTP server
'.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "nimda"
'.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Specify mail server
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
'Specify the timeout in seconds
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 8025
'Use SSL for the connection (False or True)
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
'Set objCDO.Configuration = iConf
With ObjCDO
Set .Configuration = iConf
.To=fto
.From=ffrom
.subject=fsub
.HTMLBody=fbody
.send
End With
'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
end function
Public Function GenerateID(FldName,tblName)
' ByVal tblName As String, ByVal FldName As String
'set dbConn=Server.CreateObject("ADODB.Connection")
'strProvider=Session("connectionstring")
'dbConn.Open strProvider
set rs=server.CreateObject("Adodb.Recordset")
rs.CursorLocation = 3 'adUseClient
rs.CursorType = 3
'rs.open strsql,conn
strsql = "Select Max("& FldName &") As RecID From "& tblName &""
rs.open strsql,conn
If rs.RecordCount > 0 Then
If IsNull(rs("RecId")) Then
GenerateID = 1
Else
response.write(rs("RecId"))
GenerateID = cint(rs("RecId")) + 1
End If
Else
GenerateID = 1
end if
rs.Close
End Function
'************************************************************************************
'Display Full table from database
Public Sub DisplayData(query,dispfull,disphead)
set dbConn=Server.CreateObject("ADODB.Connection")
strProvider=Session("connectionstring")
dbConn.Open strProvider
if dispfull=true then
set rsTable=conn.execute("select * from " & query)
elseif dispfull=false then
set rsTable=conn.execute(query)
end if
%>
<table>
<% if disphead=true then %>
<tr>
<% for each field in rsTable.Fields %>
<td><%= field.Name %></td>
<% next %>
</tr>
<% end if %>
<% do until rsTable.EOF %>
<tr>
<% for each field in rsTable.Fields %>
<td><%= field.Value %></td>
<% next %>
</tr>
<%
rowCount = rowCount+1
rsTable.MoveNext
loop
dbConn.Close
set dbConn = Nothing
set rsTable = Nothing
%>
</table>
<% End Sub %>
<script language=javascript>
//Blank field checking
function chk_blank(ctl,msg)
{
if(msg=="")
{
msg="This field cannot be blank";
}
if (ctl.value=="")
{
alert(msg);
ctl.focus();
return (false);
}
else
return (true);
}
/*-----------------------------------------------------*/
//Valid Email Checking
function isEmailAddr(email)
{
var result = false
var theStr = new String(email)
var index = theStr.indexOf("@");
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
return result;
}
// Calling function
function chk_email(ctl,msg)
{
if(msg=="")
{
msg="Please enter a valid email address";
}
if (!isEmailAddr(ctl.value))
{
alert(msg);
ctl.value="";
ctl.focus();
return (false);
}
else
return (true);
}
/*-----------------------------------------------------*/
// Numeric checking
function chk_numric(ctl,msg)
{
if(msg=="")
{
msg="Please enter valid numeric data";
}
if (isNaN(ctl.value))
{
alert(msg);
ctl.value="";
ctl.focus();
return (false);
}
else
return (true);
}
/*-----------------------------------------------------*/
// Maxlength checking
function chk_maxlength(ctl,max,msg)
{
if(msg=="")
{
msg="Please enter atmost"+ max +"characters";
}
if (ctl.value.length > max)
{
alert(msg);
ctl.focus();
return (false);
}
return (true);
}
/*-----------------------------------------------------*/
// Minimum Length checking
function chk_minlength(ctl,min,msg)
{
if(msg=="")
{
msg="Please enter minimum "+ min +"characters";
}
if (ctl.value.length < min)
{
alert(msg);
ctl.value="";
ctl.focus();
return (false);
}
return (true);
}
/*-----------------------------------------------------*/
// String checking
function chk_string(ctl,msg)
{
if(msg=="")
{
msg="This field can never have numbers";
}
if (ctl.value!="")
{
for(var i=0;i<=9;i++)
{
var pos=ctl.value.indexOf(i);
if (pos!=-1)
{
alert(msg);
ctl.value="";
ctl.focus();
return (false);
}
}
}
return (true);
}
/*-----------------------------------------------------*/
//Equal Checking
function chk_equal(ctl1,ctl2,msg)
{
if(msg=="")
{
msg="Value of these fields should be same";
}
if(ctl1.value!=ctl2.value)
{
alert(msg);
ctl2.value="";
ctl2.focus();
return (false);
}
return (true);
}
/*-----------------------------------------------------*/
//Option button & checkbox validation
function check(ctl,n,msg)
{
if(msg=="")
{
msg="Please select a value";
}
var ctr=0;
for(i=0;i<n;i++)
{
if(ctl(i).checked==false)
{
ctr=ctr+1;
}
}
if (ctr==n)
{
alert(msg);
ctl(0).focus();
return false;
}
return true;
}
/*-----------------------------------------------------*/
//Option button & checkbox value checking
function checkval(ctl,n,msg)
{
if(msg=="")
{
msg="Please select a value";
}
var ctr=0;
var strv=""
for(i=0;i<n;i++)
{
for(i=0;i<2;i++)
{
if(ctl(i).checked==true)
{
strv=i
ctr=ctr+1;
}
}
}
if (strv != "")
{
alert(msg);
ctl(0).focus();
return false;
}
strv=""
return true;
}
/*-----------------------------------------------------*/
//Popup window
function popup(theURL,winName,features)
{
window.open(theURL,winName,features);
}
/*-----------------------------------------------------*/
//Credit card validation script
function cardval(s)
{
// remove non-numerics
var v = "0123456789";
var w = "";
for (i=0; i < s.length; i++) {
x = s.charAt(i);
if (v.indexOf(x,0) != -1)
w += x;
}
// validate number
j = w.length / 2;
if (j < 6.5 || j > 8 || j == 7) return false;
k = Math.floor(j);
m = Math.ceil(j) - k;
c = 0;
for (i=0; i<k; i++) {
a = w.charAt(i*2+m) * 2;
c += a > 9 ? Math.floor(a/10 + a%10) : a;
}
for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
return (c%10 == 0);
}
/*-----------------------------------------------------*/
function chk_hidden_fld(ctl1,ctl,msg)
{
if(msg=="")
{
msg="This field cannot be blank";
}
if (ctl1.value=="")
{
alert(msg);
ctl.focus();
return (false);
}
else
return (true);
}
</script>
|