-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
87 lines (84 loc) · 2.97 KB
/
index.php
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
<?php
include('include/header.php');
include('include/functions.php');
$error=false;
if(isset($_GET['q']))
{
$username = $_GET['q'];
if(!strlen($username)<1)
{
$username = str_replace(' ','+',$username);
$response = searchUser($username);
$total_count = $response['total_count'];
if($total_count>1 || $total_count==1)
{
$response = $response['items'];
}
else
{
$error=true;
$error = "No Record Found";
}
}
else
{
$error=true;
$error = "No Record Found";
}
}
?>
<div class="center">
<h5 class="center red-text">
<?php
if(isset($error))
{
echo $error;
}
?>
</h5>
</div>
<div class="container">
<div class="row">
<div class="col s12 m12 l12">
<form action="" method="get" align="center">
<div class="input-field">
<input type="text" name="q" id="username" placeholder="Search User" style="border: 2px solid black; border-radius:20px; "><br>
</div>
<input type="submit"class="btn black" style="height:50px; border-radius:50px;" name="" value="Search User" id=""><br><br>
</form>
</div>
</div>
</div>
<div class="row">
<?php
if($error)
{
exit();
}
if(isset($_GET['q']))
{
foreach($response as $item)
{
$name = $item['login'];
$avatar_url = $item['avatar_url'];
?>
<div class="col l2 m2 s6">
<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>
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>