Skip to content

Commit

Permalink
chat updated
Browse files Browse the repository at this point in the history
  • Loading branch information
DumiduM committed Jul 8, 2018
1 parent ca1e43d commit 7bd7504
Show file tree
Hide file tree
Showing 14 changed files with 2,226 additions and 14 deletions.
503 changes: 503 additions & 0 deletions adminAddKanna.php

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions adminChat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

session_start();
$_SESSION['username'] = "Students";

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chat Room</title>

<!-- <link rel="stylesheet" type="text/css" href="css/style.css"> -->

<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>

</head>
<body>




<div>
<div id = "wrapper">
<div class = "chat_wrapper">
<div id=chat>

</div>
<form method="POST" id="messageFrm">
<br><br>
<textarea name="message" cols="100" rows="2" class="textarea" class="form-control"></textarea>

</form>
</div>

</div>

</div>



<script>

LoadChat();

setInterval(function(){
LoadChat();
},100);

function LoadChat(){

$.post('handlers/messages.php?action=getMessages', function(response){

var scrollpos = $('#chat').scrollTop();
var scrollpos = parseInt(scrollpos) + 620;
var scrollHeight = $('#chat').prop('scrollHeight');

$('#chat').html(response);

if( scrollpos < scrollHeight){

}else{
$('#chat').scrollTop( $('#chat').prop('scrollHeight'));
}



});
}


$('.textarea').keyup(function(e){
if( e.which == 13){
$('form').submit();
}
});

$('form').submit(function(){
var message = $('.textarea').val();

$.post('handlers/messages.php?action=sendMessage&message='+message, function(response){
//alert(response);

if(response==1){
LoadChat();
document.getElementById('messageFrm').reset();
}

});

return false;
})
</script>

</body>
</html>


22 changes: 21 additions & 1 deletion adminhome.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<!-- <link rel="stylesheet" type="text/css" href="css/style.css"> -->
</head>
<body class="fixed-nav sticky-footer bg-dark" id="page-top">
<!-- Navigation-->
Expand Down Expand Up @@ -510,5 +510,25 @@ function getTable(str){
<br>
</div>
</div>
<style type="text/css">
.mapdiv{
width:100%;
margin: auto;
}

.mapdiv path {
fill: #036057;
stroke: #073833;
stroke-width:2px;
transition: fill 2.0s;
}

.mapdiv :hover {
fill:#16ba8b;
}
.mapdiv{
width: 50%;
}
</style>
</body>
</html>
Loading

0 comments on commit 7bd7504

Please sign in to comment.