-
Notifications
You must be signed in to change notification settings - Fork 11
/
chat.php
126 lines (96 loc) · 2.57 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/*
* @copyright (c) 2008 Nicolo John Davis
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
session_start();
if(!isset($_SESSION['isloggedin']))
{
echo "<meta http-equiv='Refresh' content='0; URL=login.php' />";
exit(0);
}
else
{
$username = $_SESSION['username'];
$userid = $_SESSION['userid'];
}
include('settings.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Keywords" content="programming, contest, coding, judge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="index,follow" />
<link rel="stylesheet" href="images/Envision.css" type="text/css" />
<title>Programming Contest</title>
<script type="text/javascript" src="jquery-1.3.1.js"></script>
<?php include('timer.php'); ?>
<script type="text/javascript">
<!--
function getChat()
{
var chatCount = $("#chat > span").length;
$.get("getchat.php", {already: chatCount}, function(data){
$("#chat").append(data);
if(data != '')
{
var objDiv = document.getElementById("chat");
objDiv.scrollTop = objDiv.scrollHeight;
}
});
}
$(document).ready(
function()
{
dispTime();
getLeaders();
getDetails();
getChat();
setInterval("dispTime()", 1000);
setInterval("getLeaders()", getLeaderInterval);
setInterval("getDetails()", getLeaderInterval);
setInterval("getChat()", getChatInterval);
$(".chatform").focus();
$(".chatform").keypress( function(e) {
if(e.which == 13)
{
var msg = this.value;
this.value = "";
//$.post("submitchat.php", { message: msg }, function(data){ getChat(); }); This was causing duplication
if(msg != "") //To prevent empty line messages
$.post("submitchat.php", { message: msg });
}
});
}
);
-->
</script>
</head>
<body class="menu6">
<!-- wrap starts here -->
<div id="wrap">
<!--header -->
<?php include('header.php'); ?>
<!-- menu -->
<?php include('menu.php'); ?>
<!-- content-wrap starts here -->
<div id="content-wrap">
<div id="main">
<div id="chat"> </div>
<input maxlength="60" class="chatform" type="text" />
</div>
<div id="sidebar">
<?php include('sidebar.php'); ?>
</div>
<!-- content-wrap ends here -->
</div>
<!--footer starts here-->
<div id="footer">
<?php include('footer.php'); ?>
</div>
<!-- wrap ends here -->
</div>
</body>
</html>