invite.cmd.php3

来自「使用PHP编程的聊天室」· PHP3 代码 · 共 27 行

PHP3
27
字号
<?php

// Check for invalid characters in the user name
if ($Cmd[2] != "" && ereg("[\ ]", stripslashes($Cmd[2])))
{
	$Error = L_ERR_USR_16;
}
else
{
	$IsCommand = true;
	$TimeSend = time();
	// Message to add if user need to be registered to enter the current room
	$ReqRegist = ($T == "0" ? ".\' \'.L_ERR_USR_14" : "");
	// Get all addressee and insert a message for each one
	$Invited = explode (",", stripslashes($Cmd[2]));
	for ($i = 0; $i < count($Invited); $i++)
	{
		$Invited[$i] = trim($Invited[$i]);
		if ($Invited[$i] == "") continue;
		$DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS inviteTo', '$Latin1', '$TimeSend', '$Invited[$i]', 'sprintf(L_INVITE, \"".special_char($U,$Latin1)."\", \"JOIN\", \"#".addslashes(special_char($R,0))."\", \"".special_char($R,0)."\")$ReqRegist')");
	};
	unset($Invited);
	// Insert a message for the sender
	$DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS inviteFrom', '$Latin1', '$TimeSend', '$U', 'sprintf(L_INVITE_DONE, \"".special_char($Cmd[2],0)."\")')");
};

?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?