-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
74 lines (55 loc) · 1.67 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
<?php
require_once( 'common/PHP/common_session.php' );
require_once ( 'common/PHP/common_session validate.php' );
require_once ( 'common/PHP/common_database.php' );
?>
<?php
$query = "SELECT DISTINCT(`channel`) FROM `messages`";
$stmt = $dbh->prepare ( $query );
$stmt->execute ( );
$rslts = $stmt->fetchAll();
$channelIDs = array();
foreach($rslts as $rslt)
{
array_push($channelIDs, $rslt['channel']);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Message Board</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/typeahead.js-bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="panel panel-default">
<div class="panel-body">
<em>Multi-Room Multi-User Chat</em>
<a class="pull-right" href="Log Out/logOut.php">Log Out</a>
</div>
</div>
<br><br><br>
<div class="container">
<form class="col-sm-8 form-horizontal" role="form" action="channel.php">
<div class="form-group">
<label for="channelID" class="col-sm-3 control-label">Enter Channel : </label>
<div class="col-sm-4"><input name="channelID" class="form-control typeahead" autocomplete="off"></div>
<div class="col-sm-4"><input class="btn btn-primary" type="submit" value="Go!"></div>
</div>
</form>
</div>
<script src="js/jQuery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/typeahead.js"></script>
<script>
$(document).ready(function() {
$('.typeahead').typeahead({
name: 'channelIDs',
local: <?php echo json_encode($channelIDs); ?>
});
});
</script>
</body>
</html>