-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.php
48 lines (43 loc) · 1.63 KB
/
chat.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
<?php
if (isset($_POST))
{
if (isset($_POST['yourname'])
&& isset($_POST['theirname'])
&& !empty($_POST['theirname'])
&& !empty($_POST['yourname']))
{
setcookie('chat_you',$_POST['yourname']);
setcookie('chat_them',$_POST['theirname']);
}
}
if (!isset($_COOKIE['chat_you']) || !isset($_COOKIE['chat_them']))
header('Location:index.php');
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Long Polling Demo</title>
<meta name="description" content="Long Polling Demo">
<meta name="author" content="Enginuity Diagnostics">
<link type="text/css" rel="stylesheet" href="style.css" media="all"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
prepareForm();
});
</script>
</head>
<body>
<div id="container" style="margin-top:20px;">
<a href="logout.php" style="margin-left:80%">Logout</a>
<form id="sendform" action="#" method="post">
<textarea id="listenmessage" class="message" readonly="readonly" style="background:ivory;padding-top:0px !important"></textarea>
<textarea id="sendmessage" class="message" style="height:80px;" placeholder="Message"></textarea>
<input id="sendSubmit" type="submit" value="Send" class="submit" style="width:50%;height:40px;"/>
<p id="sendstatus" class="status">Message sent</p>
</form>
</div>
</body>
</html>