Skip to content

Commit dba9cd0

Browse files
author
codeblogger
committed
html, css and js
1 parent 633a04e commit dba9cd0

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
body{
2+
background: url("https://images.pexels.com/photos/1896021/pexels-photo-1896021.jpeg?cs=srgb&dl=architecture-buildings-business-1896021.jpg&fm=jpg");
3+
background-size: cover;
4+
}
5+
#login_table{
6+
position: absolute;
7+
top: 50%;
8+
left: 50%;
9+
transform: translate(-50%,-50%);
10+
width: 400px;
11+
}
12+
input{
13+
opacity: .5;
14+
}
15+
input:focus{
16+
opacity: 1;
17+
}
18+
19+
.modal {
20+
display: none;
21+
position: fixed;
22+
z-index: 1;
23+
padding-top: 100px;
24+
left: 0;
25+
top: 50px;
26+
width: 100%;
27+
height: 100%;
28+
overflow: auto;
29+
background-color: rgb(0,0,0);
30+
background-color: rgba(0,0,0,0.4);
31+
}
32+
33+
.modal-content {
34+
background-color: #ccc;
35+
margin: auto;
36+
padding: 20px;
37+
border: 1px solid #888;
38+
width: 500px !important;
39+
text-align: center;
40+
font-size: 20px !important;
41+
}
42+
43+
.close {
44+
color: #aaaaaa;
45+
float: right;
46+
font-size: 42px !important;
47+
font-weight: bold;
48+
}
49+
50+
.close:hover,
51+
.close:focus {
52+
color: #000;
53+
text-decoration: none;
54+
cursor: pointer;
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>CARD GAME</title>
6+
<link rel="stylesheet" type="text/css" href="JS CLASS - Login System.css">
7+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
8+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
9+
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
12+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
13+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
14+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
15+
</head>
16+
<body>
17+
18+
<div id="login_table">
19+
<div class="input-group mb-3">
20+
<div class="input-group-prepend">
21+
<span class="input-group-text"><i class="fas fa-user"></i></span>
22+
</div>
23+
<input type="text" class="form-control" id="username" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
24+
</div>
25+
<div class="input-group mb-3">
26+
<div class="input-group-prepend">
27+
<span class="input-group-text"><i class="fas fa-lock-open"></i></span>
28+
</div>
29+
<input type="password" class="form-control" id="password" placeholder="Password" aria-label="Username" aria-describedby="basic-addon1">
30+
</div>
31+
<button id="login" class="btn btn-dark btn-lg btn-block">LOGIN</button>
32+
</div>
33+
34+
<div id="myModal" class="modal">
35+
<div class="modal-content">
36+
<span class="close">&times;</span>
37+
<p class="message"></p>
38+
</div>
39+
</div>
40+
41+
42+
43+
<script>
44+
45+
class Users{
46+
constructor(username,password){
47+
this.username = username;
48+
this.password = password;
49+
}
50+
control_variable(control_username,control_password){
51+
this.control_username = control_username;
52+
this.control_password = control_password;
53+
}
54+
control(){
55+
if(this.control_username == this.username && this.control_password == this.password){
56+
$(".message").text(`WELCOME ${$('#username').val()}`)
57+
}else{
58+
$(".message").text('You have entered incorrectly.')
59+
}
60+
}
61+
};
62+
63+
let User_variables = {
64+
// username : password
65+
"furkan" : 'gulsen',
66+
"maria" : "allen",
67+
"bob" : "quenn",
68+
'rick' : 'rick123'
69+
}
70+
71+
var modal = document.getElementById('myModal');
72+
var btn = document.getElementById("myBtn");
73+
var span = document.getElementsByClassName("close")[0];
74+
75+
$("#login").click(function(){
76+
let user = new Users($('#username').val(), $('#password').val());
77+
var password = User_variables[$('#username').val()]
78+
user.control_variable($('#username').val(),password);
79+
user.control();
80+
modal.style.display = "block";
81+
});
82+
83+
span.onclick = function() {
84+
modal.style.display = "none";
85+
};
86+
87+
window.onclick = function(event) {
88+
if (event.target == modal) {
89+
modal.style.display = "none";
90+
}
91+
}
92+
93+
</script>
94+
</body>
95+
</html>

0 commit comments

Comments
 (0)