Menu

[r96]: / chat_online.php  Maximize  Restore  History

Download this file

160 lines (116 with data), 6.1 kB

  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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
##############################################################################################
# #
# chat_online.php #
# * ------------------- #
# * begin : Saturday, February 11, 2006 #
# * copyright : (C) 2004-2008 CompWebChess2 Development Team #
# * support : http://www.compwebchess.com/cms/index.php #
# * VERSION: : $Id: chat_online.php,v 1.3 2008/11/13 20:11:43 nelson8317 Exp $ #
# #
##############################################################################################
# This program is free software; you can redistribute it and/or modify it under the #
# terms of the GNU General Public License as published by the Free Software Foundation; #
# either version 2 of the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License along with this #
# program; if not, write to: #
# #
# Free Software Foundation, Inc., #
# 59 Temple Place, Suite 330, #
# Boston, MA 02111-1307 USA #
##############################################################################################
session_start();
/* load settings */
if (!isset($_CONFIG))
require_once './includes/config.inc.php';
/* define constants */
require_once './includes/chessconstants.inc.php';
/* include outside functions */
if (!isset($_CHESSUTILS))
require_once './includes/chessutils.inc.php';
require_once './includes/gui.inc.php';
require_once './includes/chessdb.inc.php';
require_once './includes/move.inc.php';
require_once './includes/undo.inc.php';
/* allow WebChess to be run on PHP systems < 4.1.0, using old http vars */
fixOldPHPVersions();
/* check session status */
require_once './includes/sessioncheck.inc.php';
/* if this page is accessed directly (ie: without going through login), */
/* player is logged off by default */
if (!isset($_SESSION['playerID']))
$_SESSION['playerID'] = -1;
/* debug flag */
define ("DEBUG", 0);
/* connect to database */
require_once './includes/connectdb.inc.php';
/* Language selection */
require_once "languages/english/strings.inc.php";
?><html>
<head>
<!-- Automatischer Refresh in Sekunden -->
<META HTTP-EQUIV=Refresh CONTENT="10; URL=chat_online.php">
<title><?php echo "$CFG_SITE_NAME";?> - Public Chat Room</title>
<link rel="stylesheet" href="./themes/<?=$_SESSION["pref_colortheme"]?>/styles.css" type="text/css">
<style>
TABLE {font-size:12; font-family: verdana;}
</style>
</head>
<body class='TD' leftmargin="0" topmargin="0">
<?
echo "
<table class='STATUSTABLE' border='0' width='100%' cellpadding='0' cellspacing='0'> ";
?>
<tr>
<td class='TD' style="text-align: left">
<font face="Verdana" size="2">
<?
// User Online Management
// By Thomas M?ller (thomas@fivedigital.net)
// Five Digital (http://www.fivedigital.net)
$minutes = 5; // Anzahl der Minuten die ein User als inaktiv Online gilt
$minutes = $minutes * 60;
$playerID = $_SESSION['playerID'];
$time = time();
$tmp = mysql_query("SELECT time FROM chat_online WHERE playerID='$playerID'");
$tmp = mysql_fetch_array($tmp);
$tmp = $tmp['time'];
if ($tmp) {
mysql_query("UPDATE chat_online SET time = '$time' WHERE playerID='$playerID'");
}
// Neuer User
else {
$pl = mysql_query("SELECT * FROM players WHERE playerID='".$_SESSION['playerID']."'");
$me = mysql_fetch_array($pl);
mysql_query("INSERT INTO chat_online VALUES ('$playerID', '$time')");
$msg = $me['nick'] . "event-enter";
mysql_query("insert into testchat (fromID,msg,gameID) VALUES ('0','$msg','".$_SESSION[gameID]."')");
}
$deltime = $time - $minutes;
// Inaktive User l?schen
mysql_query("DELETE FROM chat_online WHERE time < '$deltime'");
// XXX Betrit den Chat l?schen
$minutes = 60; // Anzahl der Minuten die Messages gel?scht werden
$minutes = $minutes * 60;
$deltime = $time - $minutes;
mysql_query("DELETE FROM testchat WHERE UNIX_TIMESTAMP(hora) < '$deltime' AND fromID = '0'");
$p = mysql_query("SELECT c.playerID, p.* from chat_online c
LEFT JOIN players p
ON p.playerID = c.playerID");
while($ids = mysql_fetch_array($p))
{
echo "<b>" . $ids['nick'] . "</b><br /> ";
} // while
// Ende User Online Management
?>
</font>
</td>
</tr>
</table>
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.