-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
151 lines (116 loc) · 8.02 KB
/
search.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
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
<?php
require ("object.php");
require('head.php');
if(empty($_SESSION['name']))
{
header('location:index.php');
}
if(isset($_POST['search']) )
{
$get_search_details = $_POST['search'];
$get_object_class = new Database_object_oriented_index();
$conn = $get_object_class->connect_to_database_function();
if($conn)
{
$sql = "SELECT * FROM `profile` WHERE `username` = '$get_search_details' OR `email` = '$get_search_details'";
$result = $conn->query($sql);
if($result->num_rows > 0)
{
while ($row = $result->fetch_assoc()) {
# code...
$username = $row["username"];
// $password = $row["password"];
$email = $row["email"];
$bio = $row["bio"];
$image = $row["image"];
$temprament = $row["temprament"];
}
echo "
<center>
<br>
<div class = 'bg-light' style = 'width:400px;padding:20px 20px 20px 20px;border-radius:30px'>
<div style = ' padding-top:50px; '>
<center>
<img alt = 'icon' src = '$image' width = '200px' height = '200px'style = 'border-radius:50%;' />
<p style = 'margin-top:20px;'> Bio :$bio</p>
</center>
</div>
<div style = ' padding:90px 0px 0px 10px; '>
<center>
<p style = 'margin-top:20px;'> Username :$username</p>
<p style = 'margin-top:20px;'> Email :$email</p>
<p style = 'margin-top:20px;'> Temprament :$temprament</p>
</center>
</div>
</div>
</center>
";
}
else
{
echo "
<center>
<p style = 'font-size:50px; margin-top:50px;'>No data available</p>
<p style = 'font-size:18px; margin-top:10px;'>Try a valid username</p>
</center>
";
}
}
?>
<style>
#takeNav{
display: block;
padding:20px 30px 50px 10px;
}
@media (max-width: 520px) {
#takeNav{
display: none;
}
}
</style>
<?php
$sql = "SELECT * FROM `feed` WHERE `sender` = '$get_search_details' ORDER BY `id` DESC";
$result = $conn->query($sql);
if($result->num_rows > 0 )
{
while ($row = $result->fetch_assoc())
{
$get_poster = $row['sender'];
$get_feed_image = $row['image'];
$get_feed_status = $row['status'];
echo "
<center>
<div style = 'margin-top:20px; height:360px;width:400px;border-radius:20px; padding:5px 15px 15px 10px;' class = 'bg-light'>
<div style = 'margin-top:15px;margin-bottom:30px;'>
<a href = 'fetch_friend_profile.php' style = 'text-decoration:none;color:black;float:left;'>
<img src='$image' alt='icon' style = 'width:40px;height:40px;border-radius:50%;margin:1px 10px 0px 4px;float:left;'>
</a>
<div style = 'float:left;font-size:12px;margin-bottom:3px;text-align:left;'>$username <br>
$email </div>
</div>
<div style = 'width:100%'>
<img alt = 'icon' src = '$get_feed_image' style = 'width:330px;height:190px;border-radius:30px;'/>
<div style = 'font-size:12px;margin-bottom:3px;text-align:left;margin-top:10px;'>$get_poster:
$get_feed_status </div>
</div>
<div>
<form method = 'post' action='newsFeed.php'>
<div style = 'margin-left:10px'>
<input class='form-control' name = 'chat' placeholder= 'Comment here'
style='margin-top: 5px; width:66%;margin-left:10px;float:left;margin-right:-70px;border-radius:40px;'/>
<input type='image' name = 'send_comment_feed' src = 'images/feedSend.png' style=';margin-top:10px;width :30px; height:30px;' />
</div>
</form>
</div>
</div>
</center>";
}
}
else{
echo "<center>
<p style = 'font-size:50px; margin-top:50px;'>No feeds available for this user</p>
<p style = 'font-size:18px; margin-top:10px;'>Available feeds would be displayed here</p>
</center>";
}
}
?>