-
Notifications
You must be signed in to change notification settings - Fork 0
/
tchatperso.php
73 lines (53 loc) · 1.74 KB
/
tchatperso.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
<?php
include("page/navPerso.php");
?>
<?php
if ($_SESSION["mdpVrai"]=="cestlemdp" && !empty($_SESSION["loginVrai"]) && !empty($_SESSION["nomTable"]))
{
if ($conn->connect_error)
{
echo"erreur de connection à la base de donnée";
}
?>
<div class='container'>
<article id='tchat' style=' padding:0; margin:0;position: fixed;
height: 90%;' >
<div id='tchatFenetre'>
<?php echo"bienvenue " .$_SESSION['loginVrai']; ?>
<div style='display:block; background-color:black; height: 1px;'></div>
</div>
<span id="message" style= 'display: block; height:75%; overflow: scroll;'>
<?php
$table = $_SESSION["nomTable"];
lecturetchatBddmyDBTO($table);
?>
</span>
<div id='formTchat' class='container'>
<!---action="tchat/action.php" method="post"-->
<form>
<div class="form-group">
<input id="messageInput" type="text" name="message" class="form-control"/>
<button class="btn btn-primary" id="buttonTchat2">valider</button>
</div>
</form>
</div>
</article>
</div>
<!-- chargement du dernier message avec jquery !-->
<script src="js/charge.js"></script>
<script>
$("#buttonTchat2").click(function(){
var donnee = $("#messageInput").val();
console.log("donne du input: " + donnee);
$.post(
"tchat/action.php",
{message: donnee},
function(data,success){
console.log("data: " + data + " et success: " + success);
});
});
</script>
<?php
}
?>
</body>