|
From: Lo?c C. <lo...@us...> - 2001-04-13 19:30:59
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs
In directory usw-pr-cvs1:/tmp/cvs-serv9614/chat/lib/index_libs
Modified Files:
start_page.lib.js main_index.lib.php3
index_validation.lib.php3 do_enter_db_work.lib.php3
Log Message:
Fix some important bugs about logging... first alpha release is not so far now ;)
Index: start_page.lib.js
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/start_page.lib.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** start_page.lib.js 2001/04/10 15:00:06 1.3
--- start_page.lib.js 2001/04/13 19:30:55 1.4
***************
*** 177,181 ****
return false;
}
! else if (reNick.test(nickField.value)) // invalid characters in
{ // the nick
nickField.focus();
--- 177,181 ----
return false;
}
! else if (reNick.test(nickField.value)) // invalid characters in
{ // the nick
nickField.focus();
***************
*** 219,222 ****
--- 219,223 ----
// All the tests have been succesfully passed -> submit the from
+ document.forms['startingForm'].elements['isJsValidated'].value = 1;
return true;
} // end of the function 'pmcIndexValidate()'
Index: main_index.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/main_index.lib.php3,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** main_index.lib.php3 2001/04/13 08:59:26 1.12
--- main_index.lib.php3 2001/04/13 19:30:55 1.13
***************
*** 79,85 ****
$createRoomName = pmcHandleMagicQuotes($createRoomName, '1', '', 'del');
if (!empty($cookieUsername))
! $cookieUsername = pmcHandleMagicQuotes($cookieUsername, '1', '', 'del');
if (!empty($cookieRoom))
! $cookieRoom = pmcHandleMagicQuotes($cookieRoom, '1', '', 'del');
--- 79,85 ----
$createRoomName = pmcHandleMagicQuotes($createRoomName, '1', '', 'del');
if (!empty($cookieUsername))
! $cookieUsername = urldecode(pmcHandleMagicQuotes($cookieUsername, '1', '', 'del'));
if (!empty($cookieRoom))
! $cookieRoom = urldecode(pmcHandleMagicQuotes($cookieRoom, '1', '', 'del'));
***************
*** 126,130 ****
* 'chat/lib/common.lib.php3' library
*/
! $error = '';
// Get the relative path to the script that called this one
--- 126,132 ----
* 'chat/lib/common.lib.php3' library
*/
! $error = '';
! if (empty($isJsValidated))
! $isJsValidated = 0;
// Get the relative path to the script that called this one
***************
*** 233,248 ****
if (isset($newTargetRoom))
{
! $roomType = substr($newTargetRoom, 0, 1);
! $targetRoom = substr($newTargetRoom, 1);
unset($newTargetRoom);
! $reloading = 'joinCmd';
! $jsVersion = $dbSessionVars['jsVersion'];
}
// fix for the NS resize bug case
else if (isset($reloading) && $reloading == 'nsResize')
{
! $roomType = $dbSessionVars['roomType'];
! $targetRoom = $dbSessionVars['currentRoom'];
! $jsVersion = $dbSessionVars['jsVersion'];
}
--- 235,251 ----
if (isset($newTargetRoom))
{
! $roomType = substr($newTargetRoom, 0, 1);
! $targetRoom = substr($newTargetRoom, 1);
unset($newTargetRoom);
! if (empty($reloading))
! $reloading = 'joinLink';
! $jsVersion = $dbSessionVars['jsVersion'];
}
// fix for the NS resize bug case
else if (isset($reloading) && $reloading == 'nsResize')
{
! $roomType = $dbSessionVars['roomType'];
! $targetRoom = $dbSessionVars['currentRoom'];
! $jsVersion = $dbSessionVars['jsVersion'];
}
***************
*** 307,311 ****
{
$error = pmcValidateNickAndPaswd( $isRegUser, $regUserPerms, $regUserModeratedRooms,
! $wasInRoom);
if ($error == '')
{
--- 310,314 ----
{
$error = pmcValidateNickAndPaswd( $isRegUser, $regUserPerms, $regUserModeratedRooms,
! $previousId, $wasInRoom);
if ($error == '')
{
***************
*** 343,347 ****
* In these cases, banishement of the user has already been checked.
*/
! if ($error == '' && empty($reloading))
{
if (C_BANISH && $regUserPerms != 'admin')
--- 346,351 ----
* In these cases, banishement of the user has already been checked.
*/
! if ($error == ''
! && (empty($reloading) || $reloading == 'joinLink'))
{
if (C_BANISH && $regUserPerms != 'admin')
***************
*** 501,505 ****
$layoutNick = $dbSessionVars['nick'];
else if (isset($GLOBALS['cookieUsername']))
! $layoutNick = $GLOBALS['cookieUsername'];
else
$layoutNick = '';
--- 505,509 ----
$layoutNick = $dbSessionVars['nick'];
else if (isset($GLOBALS['cookieUsername']))
! $layoutNick = urldecode($GLOBALS['cookieUsername']);
else
$layoutNick = '';
***************
*** 508,512 ****
$layoutRoom = $dbSessionVars['currentRoom'];
else if (isset($GLOBALS['cookieRoom']))
! $layoutRoom = $GLOBALS['cookieRoom'];
else
$layoutRoom = '';
--- 512,516 ----
$layoutRoom = $dbSessionVars['currentRoom'];
else if (isset($GLOBALS['cookieRoom']))
! $layoutRoom = urldecode($GLOBALS['cookieRoom']);
else
$layoutRoom = '';
***************
*** 585,588 ****
--- 589,593 ----
?>
<input type="hidden" name="jsVersion" value="low" />
+ <input type="hidden" name="isJsValidated" value="0" />
<table border="0" cellpadding="3" class="chatTable">
Index: index_validation.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/index_validation.lib.php3,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** index_validation.lib.php3 2001/04/11 23:06:14 1.5
--- index_validation.lib.php3 2001/04/13 19:30:55 1.6
***************
*** 35,58 ****
* phpMyChat
*
! * @param $isRegNick true if the nick is a registered one
! * @param $regNickPerms permission level associated to the nick
! * @param $regNickModeratedRooms list of the room moderated by the user
! * @param $loggedInRoom name of the room the user was chatting into
*
! * @return string error number (empty if no error)
*
! * @global object the instance of the pmcDB object
! * @global string the nick of the user who wants to enter the
! * chat
! * @global string the slashed nick of the user who wants to
! * enter the chat
! * @global string the password entered by this user
! * @global string the md5 hash of this password
*
* @access public
*/
function pmcValidateNickAndPaswd( &$isRegNick, &$regNickPerms, &$regNickModeratedRooms,
! &$loggedInRoom)
{
global $dbLink;
global $nick, $slashedNick;
--- 35,60 ----
* phpMyChat
*
! * @param string true if the nick is a registered one
! * @param string permission level associated to the nick
! * @param string list of the room moderated by the user
! * @param string previous id of the user whith the same nick
! * @param string name of the room the user was chatting into
*
! * @return string error number (empty if no error)
*
! * @global integer whether a quick javascript validation ran or not
! * @global object the instance of the pmcDB object
! * @global string the nick of the user who wants to enter the chat
! * @global string the slashed nick of the user who wants to enter
! * the chat
! * @global string the password entered by this user
! * @global string the md5 hash of this password
*
* @access public
*/
function pmcValidateNickAndPaswd( &$isRegNick, &$regNickPerms, &$regNickModeratedRooms,
! &$loggedInId, &$loggedInRoom)
{
+ global $isJsValidated;
global $dbLink;
global $nick, $slashedNick;
***************
*** 65,74 ****
// 1. Ensures invalid characters/words aren't in use for the nick
// Ensures a nick has been submitted
! if ($nick == '')
{
$error1 = L_ERR_USR_2;
}
// Checks for invalid characters or empty nick
! else if (trim($nick) == '' || ereg('[\, ]', $nick))
{
$error1 = L_ERR_USR_16;
--- 67,77 ----
// 1. Ensures invalid characters/words aren't in use for the nick
// Ensures a nick has been submitted
! if (!$isJsValidated && $nick == '')
{
$error1 = L_ERR_USR_2;
}
// Checks for invalid characters or empty nick
! else if (!$isJsValidated &&
! (trim($nick) == '' || ereg('[\, ]', $nick)))
{
$error1 = L_ERR_USR_16;
***************
*** 86,91 ****
if ($error1 == '')
{
! $dbLink->query("SELECT room FROM " . C_USR_TBL . " WHERE username = '$slashedNick' LIMIT 1");
! $isLoggedIn = (list($loggedInRoom) = $dbLink->nextRecord());
if ($isLoggedIn)
{
--- 89,94 ----
if ($error1 == '')
{
! $dbLink->query("SELECT session_id, room FROM " . C_USR_TBL . " WHERE username = '$slashedNick' LIMIT 1");
! $isLoggedIn = (list($loggedInId, $loggedInRoom) = $dbLink->nextRecord());
if ($isLoggedIn)
{
***************
*** 152,170 ****
* the user will be granted inside this room
*
! * @param $userPerms permission level associated to the nick
! * @param $userModeratedRooms list of the room moderated by the user
*
! * @return string error number
*
! * @global object the instance of the pmcDB object
! * @global string the slashed nick of the user who wants to
! * enter the chat
! * @global boolean whether this nick is a registered one or
! * not
! * @global string the name of the room to create
! * @global string the slashed name of the room to create
! * @global integer the type of the room to create
! * @global string the list of default public rooms
! * @global string the list of default private rooms
*
* @access public
--- 155,171 ----
* the user will be granted inside this room
*
! * @param string permission level associated to the nick
! * @param string list of the room moderated by the user
*
! * @return string error number
*
! * @global integer whether a quick javascript validation ran or not
! * @global object the instance of the pmcDB object
! * @global string the slashed nick of the user who wants to enter the chat
! * @global boolean whether this nick is a registered one or not
! * @global string the name of the room to create
! * @global integer the type of the room to create
! * @global string the list of default public rooms
! * @global string the list of default private rooms
*
* @access public
***************
*** 172,182 ****
function pmcValidateRoomCreation(&$userPerms, &$userModeratedRooms)
{
global $dbLink;
global $slashedNick;
global $isRegUser;
! global $createRoomName, $slashedRoomName, $roomType;
global $defaultChatRooms, $defaultPrivateRooms;
$error2 = '';
// 1. Validates the room name
--- 173,185 ----
function pmcValidateRoomCreation(&$userPerms, &$userModeratedRooms)
{
+ global $isJsValidated;
global $dbLink;
global $slashedNick;
global $isRegUser;
! global $createRoomName, $roomType;
global $defaultChatRooms, $defaultPrivateRooms;
$error2 = '';
+ $isNewRoom = true;
// 1. Validates the room name
***************
*** 192,196 ****
}
// Checks for invalid characters or empty room name
! else if (trim($createRoomName) == '' || ereg('[\,]', $createRoomName))
{
$error2 = L_ERR_ROM_1;
--- 195,200 ----
}
// Checks for invalid characters or empty room name
! else if (!$isJsValidated &&
! (trim($createRoomName) == '' || ereg('[\,]', $createRoomName)))
{
$error2 = L_ERR_ROM_1;
***************
*** 202,223 ****
}
// Ensures there is no existing room with the same name but a different
! // type...
else
{
// ...among reserved name for private/public (default) rooms
$searchIn = ($roomType == 1) ? $defaultPrivateRooms : $defaultChatRooms;
! if (pmcIsInto($slashedRoomName, $searchIn) >= 0)
$error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4;
unset($searchIn);
// ...among other rooms created by users
! if ($error2 == '')
{
! $oppositeType = 1 - $roomType;
! $dbLink->query("SELECT COUNT(*) FROM " . C_MSG_TBL . " WHERE room = '$slashedRoomName' AND type = '$oppositeType' LIMIT 1");
! list($isOpposite) = $dbLink->nextRecord();
$dbLink->cleanResults();
! if ($isOpposite != 0)
! $error2 = ($T == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4;
}
}
--- 206,253 ----
}
// Ensures there is no existing room with the same name but a different
! // type and if this condition is true get case sensitive name of room...
else
{
+ $theSlashedRoomName = pmcSlashSingleQuotes($createRoomName);
+
// ...among reserved name for private/public (default) rooms
$searchIn = ($roomType == 1) ? $defaultPrivateRooms : $defaultChatRooms;
! if (pmcIsInto($createRoomName, $searchIn) >= 0)
! {
$error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4;
+ }
+ else
+ {
+ $searchIn = ($roomType == 1) ? $defaultChatRooms : $defaultPrivateRooms;
+ $roomExist = pmcIsInto($createRoomName, $searchIn);
+ if ($roomExist >= 0)
+ {
+ $isNewRoom = false;
+ if ($roomType == 1)
+ {
+ $GLOBALS['enterDefaultRoomName'] = $searchIn[$roomExist];
+ $createRoomName = '';
+ }
+ else
+ {
+ $createRoomName = $searchIn[$roomExist];
+ }
+ }
+ }
unset($searchIn);
// ...among other rooms created by users
! if ($error2 == '' && $isNewRoom)
{
! $dbLink->query("SELECT type, room FROM " . C_MSG_TBL . " WHERE room = '$theSlashedRoomName' LIMIT 1");
! $roomExist = (list($trueType, $trueCaseName) = $dbLink->nextRecord());
$dbLink->cleanResults();
! if ($roomExist)
! {
! if ($roomType != $trueType)
! $error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4;
! else
! $createRoomName = pmcHandleMagicQuotes($trueCaseName, '', 1, 'del');
! }
}
}
***************
*** 225,260 ****
// end of the 1st stage (validation of the name of the room to create)
! // 2. Defines the permission level of the user for the room to create
! if ($error2 == '')
{
- $isNewRoom = true;
-
- // If the name of the room to be created is a reserved one for
- // private/public (default) rooms, status will be 'user'.
- // Skipped if the frameset is reloaded because of the NS4+ resize bug,
- // because the user has run a '/join' command or because he has clicked
- // on a room name at the users frame.
- if (!isset($GLOBALS['reloading']))
- {
- $searchIn = ($roomType == 1) ? $defaultChatRooms : $defaultPrivateRooms;
- $isNewRoom = (pmcIsInto($slashedRoomName, $searchIn) >= 0);
- unset($searchIn);
- }
-
// If the name of the room to be created is the same than one of an
// existing room containing 'true' messages (not only notifications of
// users entrance/exit) or containing only 'system' message but an user
// is currently logged in, status will be 'user'
! if ($isNewRoom)
! {
! $dbLink->query("SELECT COUNT(*) FROM " . C_MSG_TBL . " WHERE room = '$slashedRoomName' AND username NOT LIKE 'SYS %' LIMIT 1");
! list($isTrueMsg) = $dbLink->nextRecord();
! $isNewRoom = ($isTrueMsg == 0);
! $dbLink->cleanResults();
! }
if ($isNewRoom)
{
! $dbLink->query("SELECT COUNT(*) FROM " . C_USR_TBL . " WHERE room = '$slashedRoomName' AND username != '$slashedNick' LIMIT 1");
list($isAnybody) = $dbLink->nextRecord();
$isNewRoom = ($isAnybody == 0);
--- 255,275 ----
// end of the 1st stage (validation of the name of the room to create)
! // 2. Defines the permission level of the user for the room to create.
! // Skipped for administrator and if the room to "create" is among
! // default public ones.
! if ($error2 == '' && $isNewRoom && $userPerms != 'admin')
{
// If the name of the room to be created is the same than one of an
// existing room containing 'true' messages (not only notifications of
// users entrance/exit) or containing only 'system' message but an user
// is currently logged in, status will be 'user'
! $dbLink->query("SELECT COUNT(*) FROM " . C_MSG_TBL . " WHERE room = '$theSlashedRoomName' AND username NOT LIKE 'SYS %' LIMIT 1");
! list($isTrueMsg) = $dbLink->nextRecord();
! $isNewRoom = ($isTrueMsg == 0);
! $dbLink->cleanResults();
if ($isNewRoom)
{
! $dbLink->query("SELECT COUNT(*) FROM " . C_USR_TBL . " WHERE room = '$theSlashedRoomName' AND username != '$slashedNick' LIMIT 1");
list($isAnybody) = $dbLink->nextRecord();
$isNewRoom = ($isAnybody == 0);
***************
*** 265,269 ****
// 3. Updating permission levels inside the registered users table
! if ($error2 == '' && $isNewRoom)
{
// If an other registered user is already moderator for the room to
--- 280,286 ----
// 3. Updating permission levels inside the registered users table
! // (skipped for administrator and if the room to create is not a true new
! // one)
! if ($error2 == '' && $isNewRoom && $userPerms != 'admin')
{
// If an other registered user is already moderator for the room to
***************
*** 292,296 ****
$otherModeratedRooms = str_replace(',,', ',', $otherModeratedRooms);
$dbLink->query("UPDATE " . C_REG_TBL . " SET rooms = '" . pmcSlashSingleQuotes($otherModeratedRooms) . "' WHERE username = '" . pmcSlashSingleQuotes($otherModerator) . "'");
! $dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'r' WHERE room = '$slashedRoomName' AND username = '" . pmcSlashSingleQuotes($otherModerator) . "'");
}
unset($rooms);
--- 309,313 ----
$otherModeratedRooms = str_replace(',,', ',', $otherModeratedRooms);
$dbLink->query("UPDATE " . C_REG_TBL . " SET rooms = '" . pmcSlashSingleQuotes($otherModeratedRooms) . "' WHERE username = '" . pmcSlashSingleQuotes($otherModerator) . "'");
! $dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'r' WHERE room = '$theSlashedRoomName' AND username = '" . pmcSlashSingleQuotes($otherModerator) . "'");
}
unset($rooms);
***************
*** 311,315 ****
$changed = true;
}
! if ($changed && $userPerms != 'admin')
{
$dbLink->query("UPDATE " . C_REG_TBL . " SET perms = '$userPerms', rooms = '" . pmcSlashSingleQuotes($userModeratedRooms) ."' WHERE username = '$slashedNick'");
--- 328,332 ----
$changed = true;
}
! if ($changed)
{
$dbLink->query("UPDATE " . C_REG_TBL . " SET perms = '$userPerms', rooms = '" . pmcSlashSingleQuotes($userModeratedRooms) ."' WHERE username = '$slashedNick'");
Index: do_enter_db_work.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_db_work.lib.php3,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** do_enter_db_work.lib.php3 2001/04/13 08:59:26 1.8
--- do_enter_db_work.lib.php3 2001/04/13 19:30:55 1.9
***************
*** 28,32 ****
! // Harmonizes type and name of the room to enter in
if (!empty($createRoomName))
{
--- 28,34 ----
! /**
! * Harmonizes type and name of the room to enter in
! */
if (!empty($createRoomName))
{
***************
*** 41,52 ****
}
! // Sets cookies that will expire in one year
$cookieRoom = urlencode($targetRoom);
setcookie('cookieRoom', $cookieRoom, time() + 60*60*24*365);
setcookie('cookieRoomType', $roomType, time() + 60*60*24*365);
-
- // Gets some variables values from session data or cookies
- pmcGrabGlobals('%COOKIE');
if (dbSessionIsRegistered('msgKind'))
$msgKind = $dbSessionVars['msgKind'];
--- 43,57 ----
}
!
! /**
! * Sets cookies that will expire in one year
! */
$cookieRoom = urlencode($targetRoom);
setcookie('cookieRoom', $cookieRoom, time() + 60*60*24*365);
setcookie('cookieRoomType', $roomType, time() + 60*60*24*365);
+ /**
+ * Gets some variables values from session data or cookies
+ */
if (dbSessionIsRegistered('msgKind'))
$msgKind = $dbSessionVars['msgKind'];
***************
*** 77,88 ****
$notify = C_NOTIFY;
! // Sets the encrypted password and gets the ip on the user
if (empty($pwdHash))
$pwdHash = ($isRegUser) ? md5($password) : '';
if (empty($ip))
include('./' . _CHAT_PATH .'lib/get_ip.lib.' . C_EXTENSION);
! // Defines the user status to be put in the users table if necessary.
! // Skipped when the frameset is reloaded because of the NS4+ resize bug.
if (!isset($reloading) || $reloading != 'nsResize')
{
--- 82,99 ----
$notify = C_NOTIFY;
!
! /**
! * Sets the encrypted password and gets the ip off the user
! */
if (empty($pwdHash))
$pwdHash = ($isRegUser) ? md5($password) : '';
if (empty($ip))
include('./' . _CHAT_PATH .'lib/get_ip.lib.' . C_EXTENSION);
+
! /**
! * Defines the user status to be put in the users table (skipped when the
! * frameset is reloaded because of the NS4+ resize bug).
! */
if (!isset($reloading) || $reloading != 'nsResize')
{
***************
*** 108,112 ****
}
! // Defines some variables
$currentTime = time();
$nickForNotifications = pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1), 2);
--- 119,126 ----
}
!
! /**
! * Defines some more variables including the welcome message.
! */
$currentTime = time();
$nickForNotifications = pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1), 2);
***************
*** 119,142 ****
$slashedWelcomeMsg = pmcSlashSingleQuotes(WELCOME_MSG);
}
! // Udpates the IP address and the last log. time of the user in the
! // regsistered users table if necessary
if ($isRegUser)
$dbLink->query("UPDATE " . C_REG_TBL . " SET reg_time = '$currentTime', ip = '$ip' WHERE username = '$slashedNick'");
// 1. In the case of a registered user that relogs...
- // 1.a ...in the same room -> updates his last loggin time and his IP address;
- // 1.b ...in an other room -> kicks him from the other room, puts a
- // notification message of exit for this room, updates the users table,
- // puts a notification message of entrance for the room he logs in and
- // send him a welcome message if required.
if ($wasInRoom != '')
{
! if ($targetRoom == $wasInRoom) // Case 1.a
{
$dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', ip = '$ip' WHERE session_id = '$dbSessionId'");
}
! else // Case 1.b
{
$slashedRoomName = pmcSlashSingleQuotes($wasInRoom);
--- 133,170 ----
$slashedWelcomeMsg = pmcSlashSingleQuotes(WELCOME_MSG);
}
+
! /**
! * Udpates the IP address and the last log. time of the user in the
! * registered users table if necessary
! */
if ($isRegUser)
$dbLink->query("UPDATE " . C_REG_TBL . " SET reg_time = '$currentTime', ip = '$ip' WHERE username = '$slashedNick'");
+ /**
+ * Do the required work in the 'messages' and the 'users' tables
+ */
+ // 0. If the validated registered nick was used with an other session id, kill
+ // this "other" session
+ if (!empty($previousId) && $dbSessionId != $previousId)
+ $dbLink->query("DELETE FROM " . C_SESS_TBL . " WHERE session_id = '$previousId'");
+
+
// 1. In the case of a registered user that relogs...
if ($wasInRoom != '')
{
! // 1.a ...in the same room -> updates his last loggin time and his IP
! // address;
! if ($targetRoom == $wasInRoom)
{
$dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', ip = '$ip' WHERE session_id = '$dbSessionId'");
}
!
! // 1.b ...in an other room -> kicks him from the other room, puts a
! // notification message of exit for this room, updates the users
! // table, puts a notification message of entrance for the room he logs
! // in and send him a welcome message if required.
! else
{
$slashedRoomName = pmcSlashSingleQuotes($wasInRoom);
***************
*** 148,152 ****
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
$dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS enter', '', '$currentTime', NULL, '#666699', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')')");
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$dbSessionId'");
if (C_WELCOME)
--- 176,180 ----
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
$dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS enter', '', '$currentTime', NULL, '#666699', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')')");
! $dbLink->query("UPDATE " . C_USR_TBL . " SET session_id = '$dbSessionId', u_time = '$currentTime', room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$previousId'");
if (C_WELCOME)
***************
*** 159,173 ****
} // end of case where a registered user relogs
// 2. In the case of an user that relogs because of the resize bug of NS4+
! // updates his logging time and his IP address
! elseif (isset($reloading) && $reloading == 'nsResize')
{
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
$dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', room = '$slashedRoomName', ip = '$ip' WHERE session_id = '$dbSessionId'");
} // end of case where an is relogged because of NS4+ resize bug
! // 3. In all other cases of users entering in, sets user infos. in 'users'
! // table and puts a notification message of entrance and a welcome message
! // if required into the 'messages' table
else
{
--- 187,203 ----
} // end of case where a registered user relogs
+
// 2. In the case of an user that relogs because of the resize bug of NS4+
! // -> updates his logging time and his IP address
! else if (isset($reloading) && $reloading == 'nsResize')
{
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
$dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', room = '$slashedRoomName', ip = '$ip' WHERE session_id = '$dbSessionId'");
} // end of case where an is relogged because of NS4+ resize bug
+
! // 3. In all other cases -> sets user infos. in 'users' table and puts a
! // notification message of entrance and, if required, a welcome message into
! // the 'messages' table
else
{
***************
*** 188,192 ****
! // Prepares (ie removes unnecessary data) and saves session data
$keptLang = $dbSessionVars['lang'];
$keptFrom = $dbSessionVars['from'];
--- 218,224 ----
! /**
! * Prepares (ie removes unnecessary data) and saves session data
! */
$keptLang = $dbSessionVars['lang'];
$keptFrom = $dbSessionVars['from'];
***************
*** 211,215 ****
! // Deletes invite messages sent to the user for the room he will enter in
$dbLink->query("SELECT m_time FROM " . C_MSG_TBL . " WHERE username = 'SYS inviteTo' AND address = '$slashedNick' AND room = '$slashedRoomName'");
while (list($sentTime) = $dbLink->nextRecord())
--- 243,251 ----
! /**
! * Deletes invite messages sent to the user for the room he will enter in
! */
! if (!isset($slashedRoomName))
! $slashedRoomName = pmcSlashSingleQuotes($targetRoom);
$dbLink->query("SELECT m_time FROM " . C_MSG_TBL . " WHERE username = 'SYS inviteTo' AND address = '$slashedNick' AND room = '$slashedRoomName'");
while (list($sentTime) = $dbLink->nextRecord())
|