-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_search.php
119 lines (107 loc) · 3.64 KB
/
user_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
<?php
include('funktionen.php');
check_session();
$user_id=$_SESSION['userid'];
//echo $user_id;
$mysqli=connect();
$result=sql("select name from msg.users where user_id=$user_id",$mysqli);
$row = $result->fetch_object(); //all chats of this person
/******************
get data about the message inside
******************/
$as =$row ->name;
?>
<!DOCTYPE html>
<html lang="en">
<!--------
BOOTSTRAP TEMPLATE
--------->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Add a new Contact</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">
<img src="http://placehold.it/300x60?text=Logo" width="150" height="30" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="main.php">Home
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.php">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
<li class="nav-item">
<a class="nav-link" href="user.php?u=<?php echo $user_id; ?>"><?php echo $as; ?></a>
</li>
</ul>
</div>
</div>
</nav>
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/popper/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!--------
BOOTSTRAP TEMPLATE
--------->
<!-- Page Content -->
<div class="container">
<h1 class="mt-5">Add new Contacts</h1>
<html>
<head>
<script>
function showHint(str) {
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "gethint.php?q=" + str, true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<?php
if(isset($_GET["m"]) and $_GET["m"]=='u_not_found'){
echo"user not found";
}
?>
<p><b>Start typing a name in the input field below:</b></p>
<form class="form-inline" action="add_contact.php" method="post">
<div class="form-group">
<input type="text" name="contact" class="form-control" placeholder="Username" onkeyup="showHint(this.value)">
</div>
<div class="form-group mx-sm-3">
<button type="submit" class="btn btn-secondary">add</button>
</div>
</form>
<p><span id="txtHint"></span> </p>
</div>
</body>
</html>