-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
172 lines (155 loc) · 7.77 KB
/
profile.html
File metadata and controls
172 lines (155 loc) · 7.77 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Analytics</title>
<link rel="icon" type="image/x-icon" href="imgs/data-logo.png">
<!-- Bootstrap 5 Connection -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<!-- CSS Styling Connection -->
<link rel="stylesheet" href="style.css">
<!-- Include Chart.js library -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.7.0"></script>
</head>
<body>
<!-- Header Section -->
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">📊 Data Analytics</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="index.html">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="analytics.html">Analytics</a>
</li>
<li class="nav-item">
<a class="nav-link" href="settings.html">Settings</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
User Profile
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<li><a class="dropdown-item" href="profile.html">Profile</a></li>
<li><a class="dropdown-item" href="settings.html">Settings</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="index.html" onclick="logout()">Log Out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- Main Content Section -->
<div class="container mt-5">
<div class="card bug-bounty-card">
<div class="card-body">
<h2 class="card-title">Github</h2>
<div id="loginForm" class="login-form">
<div class="form-group">
<input type="text" class="form-control" id="username" placeholder="GitHub Username" required>
</div>
<br>
<div class="form-group">
<input type="password" class="form-control" id="password" placeholder="GitHub Password" required>
</div>
<br>
<button class="btn btn-primary" onclick="login()">Login</button>
<button class="btn btn-secondary" onclick="location.href='https://github.com/signup'">Register</button>
</div>
<div id="userData" class="user-data mt-4" style="display: none;">
<div id="stats"></div>
<button class="btn btn-danger mt-3" onclick="logout()">Logout</button>
</div>
</div>
</div>
</div>
<!-- Footer Section -->
<footer class="bg-dark text-light py-4" style="position: absolute; bottom: 0;">
<div class="container">
<div class="row">
<div class="col-md-6">
<p>© 2023 Data Analytics. All Rights Reserved.</p>
</div>
<div class="col-md-6 text-md-right">
<a class="text-light" href="#">Privacy Policy</a> |
<a class="text-light" href="#">Terms of Service</a>
</div>
</div>
</div>
</footer>
<!-- JavaScript and Additional Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js"></script>
<script type="text/javascript">
async function getUserStats(username, password) {
const url = `https://api.github.com/users/${username}`;
const response = await fetch(url, {
headers: {
Authorization: `Basic ${btoa(`${username}:${password}`)}`
}
});
if (response.status === 200) {
const userData = await response.json();
return userData;
} else {
return null;
}
}
function login() {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
getUserStats(username, password)
.then(userData => {
if (userData) {
document.getElementById('loginForm').style.display = 'none';
document.getElementById('userData').style.display = 'block';
const totalDaysActive = calculateDaysActive(userData.created_at);
const stats = document.getElementById('stats');
stats.innerHTML = `
<h2>👨💻 ${username} Profile</h2>
<p><strong>Name:</strong> <code>${userData.name}</code></p>
<p><strong>Company:</strong> <code>${userData.company}</code></p>
<p><strong>Location:</strong> <code>${userData.location}</code></p>
<p><strong>Blog:</strong> <code><a href="${userData.blog}">${userData.blog}</a></code></p>
<p><strong>Bio:</strong> <code>${userData.bio}</code></p>
<p><strong>Public Repositories:</strong> <code>${userData.public_repos}</code></p>
<p><strong>Followers:</strong> <code>${userData.followers}</code></p>
<p><strong>Following:</strong> <code>${userData.following}</code></p>
<p><strong>Total Days in Github:</strong> <code>${totalDaysActive}</code></p>
<p><strong>GitHub URL:</strong> <code><a href="${userData.html_url}" target="_blank">${userData.html_url}</a></code></p>
`;
} else {
alert('Invalid username or password. Please try again.');
}
});
}
function logout() {
document.getElementById('loginForm').style.display = 'block';
document.getElementById('userData').style.display = 'none';
document.getElementById('username').value = '';
document.getElementById('password').value = '';
}
function calculateDaysActive(createdAt) {
const currentDate = new Date();
const createdDate = new Date(createdAt);
const timeDifference = currentDate.getTime() - createdDate.getTime();
const daysDifference = timeDifference / (1000 * 3600 * 24);
return Math.floor(daysDifference);
}
</script>
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include Bootstrap JavaScript (which includes Popper.js) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>