-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreditCard.html
168 lines (150 loc) · 4.23 KB
/
creditCard.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CreditCardCheck - Validate Your Credit Card Easily</title>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js" ></script>
<script src='https://cdn.jsdelivr.net/npm/sweetalert2@9'></script><script src="./script.js"></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css'>
<script>
function myfun(){
var number=document.getElementById("myInput").value;
number=number.replace(/\s+/g, '')
if(validateCardNumber(number)){
var str=`Credit card number ${number} is valid`;
Swal.fire(
"Great", str, "success"
)}
else
{
var notvalid =`Credit card number ${number} is not valid`;
Swal.fire({
icon: 'error',
title: 'Oops...',
text: notvalid
})
}
}
function validateCardNumber(number) {
var regex = new RegExp("^[0-9]{16}$");
if (!regex.test(number))
return false;
return luhnalgo(number);
}
function luhnalgo(val) {
var sum = 0;
for (var i = 0; i < val.length; i++) {
var intVal = parseInt(val.substr(i, 1));
if (i % 2 == 0) {
intVal *= 2;
if (intVal > 9) {
intVal = 1 + (intVal % 10);
}
}
sum += intVal;
}
return (sum % 10) == 0;
}
</script>
<style>
.input-group-btn button[type="submit"] {
border-radius: 100px !important;
padding: 1rem 3rem;
margin-top: 50px;
}
html::-webkit-scrollbar {
display: none;
}
body{
background-color: rgb(71, 4, 15);
}
#particles-js {
position: fixed;
width: 100%;
height: 100%;
background-color: rgb(8, 6, 17);
left: 0px;
top: 0px;
}
#myInput{
letter-spacing: 4px;
text-align: center;
font-size:x-large;
padding:0%;
}
.landing-text{
margin-top: 40px;
font-family: "Poppins", sans-serif;
font-weight: 600;
font-size: 4rem;
text-align: center;
color: white;
opacity: 85%;
}
.label1{
margin-top: 5rem;
font-family: "Poppins", sans-serif;
font-weight: 500;
font-size: 1.5rem;
display:flex;
justify-content: center;
color: white;
opacity: 60%;
}
.copyright{
width: 100%;
text-align: center;
background-color: #232327;
color: #eee;
position: fixed;
left: 0;
bottom: 0;
}
.copyright p{
font-size: 1rem;
}
.madewithlove{
margin-top: 10px;
font-family: 'Poppins';
font-weight: 400;
letter-spacing: 1px;
}
.fa-heart{
color: red;
}
a, a:hover {
color: #149dcc;
text-decoration: none;
font-style: normal;
font-weight: 400;
cursor: pointer;
}
</style>
</head>
<body>
<div id="particles-js">
<div class="landing-text">Fraud Hunter</div>
<div class="container">
<div class="form-group shadow-textarea">
<label for="text-input" class="label1">Enter Credit Card Number and check whether it is valid</label>
<textarea class="form-control z-depth-1" id="myInput" placeholder="Enter Card Number here..." rows="1"></textarea>
</div>
</div>
<div class="col-md-12 input-group-btn " style="display:flex; justify-content: center;">
<button type="submit" class="btn btn-primary btn-form display-4" onclick="myfun()">Submit</button>
</div>
<footer class="copyright">
<div class="madewithlove">
<p>Designed with <i class="fa fa-heart pulse"></i></p>
<p>2023 - SVTB </p>
</div>
</footer>
<script src="particles.js"></script>
<script src="app.js"></script>
</body>
</html>