-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
214 lines (200 loc) · 8.38 KB
/
user.php
File metadata and controls
214 lines (200 loc) · 8.38 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
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
<?php require_once('include/header.php') ?>
<?php
$domain1 = 'http://api.github.com/users/SocialCodia';
function get_http_response_code($domain1) {
$headers = get_headers($domain1);
return substr($headers[0], 9, 3);
}
$get_http_response_code = get_http_response_code($domain1);
if ($get_http_response_code != 301 ) {
echo $get_http_response_code;
?>
<div class="center">
<br><br>
<i class="material-icons large">tag_faces</i>
<h1><b>Api Call Limit Exceeded </b></h1>
<h3><b>For Your Ip <?php echo $_SERVER['REMOTE_ADDR']; ?></b></h3>
</div>
<?php
exit();
}
?>
<?php
$error=false;
require_once('include/functions.php');
if($_GET['username'] || strlen($_GET['username'])>1)
{
$username = $_GET['username'];
$username = str_replace(' ','',$username);
$response = getUser($username);
$followersResponse = getFollowers($username);
$followingResponse = getFollowing($username);
$repositoryResponse = getRepository($username);
if(isset($repositoryResponse['message']))
{
echo "baye baye";
exit();
}
$login = $response['login'];
$name = $response['name'];
$image =$response['avatar_url'];
$followers =$response['followers'];
$following=$response['following'];
$about = $response['bio'];
$location = $response['location'];
$company = $response['company'];
$blog = $response['blog'];
}
else
{
header("LOCATION:index.php");
}
?>
<div class="row">
<div class="col s12">
<img src="http://demo.thedevelovers.com/dashboard/queenadmin-1.2/assets/img/city.jpg" style="width:100%;" height="250px" alt="">
</div>
<div class="col s12 l3 m3" style="margin-top: -120px;">
<div class="" style="padding:15px;">
<div class="center">
<img style="width: 180px; border:3px solid white" class=" circle responsive-img z-depth-1" src="<?php if(isset($image))echo $image?>" alt="">
</div>
<div class="">
<h5 class="center"><?php if(isset($name))
{
echo $name;
}
else
{
if(isset($login))echo $login;
}
?></h5>
<div class="col s6 m6 l6">
<button class="btn"> <?php if(isset($followers))echo $followers?> Followers</button>
</div>
<div class="col s6 m6 l6">
<button class="btn"> <?php if(isset($following))echo $following?> Following</button>
</div>
<br>
<br>
<div style="padding: 10px;">
<b>About Me</b>
<div class="divider"></div>
<p><?php if(isset($about))echo $about?></p>
<b>Statics</b>
<div class="divider"></div>
<b>Location : </b>
<span><?php if(isset($location))echo $location?></span>
<br>
<b>Company : </b>
<span><?php if(isset($company))echo $company?></span>
</div>
</div>
</div>
</div>
<div class="col s12 l9 m9">
<div class="card">
<div class="col s12">
<div class="col s12">
<ul class="tabs">
<li class="tab col s1"><a href="#about">About</a></li>
<li class="tab col s2"><a href="#projects">Projects</a></li>
<li class="tab col s2"><a href="#followers">Followers</a></li>
<li class="tab col s2"><a href="#followings">Followings</a></li>
</ul>
</div>
<div id="about" class="col s12">
<h5><i class="material-icons">person</i> About</h5>
<div class="col s12 m12 l6" style="padding: 20px;">
<div class="col s5 m5 l5">
<b>Name</b>
</div>
<div class="col s7 m7 l7">
<span>Umair Farooqui</span>
</div>
</div>
<div class="col s12 m12 l6">
</div>
</div>
<div id="projects" class="col s12">
<?php foreach($repositoryResponse as $project)
{
$name = $project['name'];
$avatar_url = $project['owner']['avatar_url'];
$description = $project['description'];
?>
<a href="?username=<?php if(isset($name)) echo $name; ?>">
<div class="card z-depth-0">
<div class="row">
<div class="col s2 m2 l1">
<img src="<?php if(isset($avatar_url)) echo $avatar_url; ?>" class="circle responsive-img" alt="">
</div>
<div class="col s10 l10 m11">
<b><p class="black-text"><?php if(isset($name)) echo $name; ?></p></b>
<p><?php if(isset($description)) echo $description; ?></p>
</div>
</div>
</div>
</a>
<?php
}
?>
</div>
<!-- Code For Followers Tab -->
<div id="followers" class="col s12">
<?php foreach($followersResponse as $fr)
{
$name = $fr['login'];
$avatar_url = $fr['avatar_url'];
?>
<div class="col s6 m3 l2">
<div class="card hoverable " style="border-radius: 20px 20px 0px 0px; border-top: 10px solid black; border-right: 1px solid black; border-left: 1px solid black;">
<div class=""style="padding: 20px 20px 0px 20px;" >
<img style=" border: 3px solid black;" src="<?php if(isset($avatar_url)) echo $avatar_url; ?>" alt="" class="z-depth-1 circle responsive-img">
</div>
<b><p class="center" style="margin-top: 0px;"><?php if(isset($name)) echo $name; ?></p></b>
<div class="card-saction center">
<a href="user.php?username=<?php if(isset($name)) echo $name; ?>" class="btn black" style="width: 100%; ">More</a>
</div>
</div>
</div>
<?php
}
?>
</div>
<!-- Code For Following Tabs -->
<div id="followings" class="col s12">
<?php foreach($followingResponse as $fgr)
{
$login = $fgr['login'];
$avatar_url = $fgr['avatar_url'];
?>
<div class="col s6 m3 l2">
<div class="card hoverable " style="border-radius: 20px 20px 0px 0px; border-top: 10px solid black; border-right: 1px solid black; border-left: 1px solid black;">
<div class=""style="padding: 20px 20px 0px 20px;" >
<img style=" border: 3px solid black;" src="<?php if(isset($avatar_url)) echo $avatar_url; ?>" alt="" class="z-depth-1 circle responsive-img">
</div>
<b><p class="center" style="margin-top: 0px;"><?php if(isset($name)) echo $name; ?></p></b>
<div class="card-saction center">
<a href="user.php?username=<?php if(isset($name)) echo $name; ?>" class="btn black" style="width: 100%; ">More</a>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="jquery-3.4.1.min.js"></script>
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="js/materialize.min.js"></script>
<script>
$(document).ready(function(){
$('.tabs').tabs();
});
</script>
</body>
</html>