-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
88 lines (83 loc) · 2.91 KB
/
index.php
File metadata and controls
88 lines (83 loc) · 2.91 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
<!--HOME Page-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<?php
session_start();
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: avlogin.php");
exit;
}
date_default_timezone_set('Europe/Copenhagen');
include 'dbh.inc.php';
include 'comment.inc.php';
?>
<!--responsive navbar-->
<script type="text/javascript">
function myfun(){
var x= document.getElementById("topnav");
if(x.className==="topnav"){
x.className+="responsive";
} else{
x.className="topnav";
}
}
</script>
<link rel="stylesheet" type="text/css" href="roughcss.html">
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<!--Navigation bar-->
<div class='container-fluid'>
<div id='topnav' class='topnav'>
<label id='titl' class='logo'>AllAsk</label>
<div class='topnav'>
<a href='logout.php'>Log Out</a>
<a href='myindex.php'>Profile</a>
<a href='#ask'>Home</a>
<a href='#' id='searchBar'>
<form method='POST' action='searchResults.php'>
<input type='text' name='search' placeholder='search..'>
<button type='submit' name='searchSubmit'>search</button></form></a>
<a href='#' onclick='myfun()' class='icon'><i class='fa fa-bars'></i></a>
</div>
</div><br>
<?php
//user profile pic and username section
$id=$_SESSION['username'];
$sql="SELECT * FROM users WHERE username='$id'";
$result=mysqli_query($conn,$sql);
if($row=$result->fetch_assoc()){
echo "<div class='usercontainer'>";
echo "<div class='row'>";
if ($row['status']==0) {
echo "<div class='col-md-50'><img src='uploads/profile".$id.".jpg' alt='avatar' class='avatar'>";
}
else {
echo "<div class='col-md-50'><img src='uploads/profiledefault.jpg'>";
}
echo "</div><div class='col-md-25'><p class='para'>".$id."</p></div>
<div class='col-md-25'><h3>Home</h3></div>";
echo "</div> </div>";
}
//asking new question text area
echo "<div id='ask'>Ask A Question?</div>";
echo "<div id='comment'>
<form method='POST' action='".setcomments($conn,$_SESSION['username'])."'>
<input type='hidden' name='uid' value=''>
<input type='hidden' name='date' value='".date('Y-m-d H:i:s')."'>
<textarea name='message'></textarea><br>
<button type='submit' name='commentSubmit'>Post</button>
</form>
</div>" ;
echo "<div id='ask'>All Questions..</div><hr style='margin-left:0px;'>";
getcomments($conn,$_SESSION['username']);//showing already asked questions and their replies
?>
<hr>
<center>
<footer class='foot'>Designed & Developed By Backlog_69</footer>
</center>
</body>
</html>