-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatbox.php
57 lines (48 loc) · 1.65 KB
/
chatbox.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
<?php
$link=mysqli_connect("localhost","root","");
mysqli_select_db($link,"chatapp");
?>
<?php
include "headerchatbox.php";
?>
<nav>
<section style="background-image: url('css/concrete_seamless.pneg')">
<?php
$result=mysqli_query($link,'SELECT * FROM profile_pic WHERE id="'.$id.'"');
while($row=mysqli_fetch_assoc($result)){
if ($row["profilepic"] == ""){
echo '<a href="profilepic.php?user='.$row["id"].'" class="img-blur"><img class="img-circle" src="profilepicture/default.jpg" alt="default DP" style="float: left"></a>';
echo "<br>";
echo "<a href='userprofile.php?user=".$row['id']."' class='name-blur' style='text-decoration: none;'><h1 class='name'>".$row['username']."</h1></a>";
}else{
echo "<a href='profilepic.php?user=".$row['id']."' class='img-blur'><img class='img-circle' src='profilepicture/".$row['profilepic']."' alt='DP'style='float: left'></a>";
echo "<br>";
echo "<a href='userprofile.php?user=".$row['id']."' class='name-blur' style='text-decoration: none;'><h1 class='name'>".$row['username']."</h1></a>";
}
}
?>
</section>
<article>
</article>
<aside>
<div class="textbox" id="chatlog" style="background-image: url('css/confectionary.jpg');">
<script>
var myVar = setInterval(function(){ myTimer() }, 500);
function myTimer()
{
var user='<?php echo $me; ?>';
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("chatlog").innerHTML=this.responseText;
}
};
xmlhttp.open("GET","chatbox1.php?user="+user,true);
xmlhttp.send();
}
</script>
</div>
</aside>
</nav>
</body>
</html>