⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendlogininfo.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
字号:
<?php
			//Prevent login if this username/password used by another user
			$stmt = new Statement("SELECT id, ip FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid=? AND id<>?");
			if(($rs = $stmt->process($this->userid, $this->id)) && ($rec = $rs->next())) {
				if($rec['ip'] == $this->ip)
				{
					$conn = new Connection($rec['id']);
					$conn->doLogout('login');
				}
				else
				{
					//!!!do not delete this line
					$this->userid = null;
					//!!!do not delete this line
					return $this->sendBack(new Message('lout', null, null, 'anotherlogin'));
				}
			} 
			
			$stmt = new Statement("SELECT COUNT(*) as cnt FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE ip=? AND userid IS NOT NULL"); 
			if(($rs = $stmt->process($this->ip)) && ($rec = $rs->next()) && $this->ip != $GLOBALS['fc_config']['bot_ip'])
			{
				if($rec['cnt'] >= $GLOBALS['fc_config']['loginsPerIP'])
				{
					$this->userid = null;
					return $this->sendBack(new Message('lout', null, null, 'iplimit'));
				}
			}
						
			//Prevent login from banned users/IPs
			$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}bans WHERE (banneduserid=? OR ip=?) AND roomid IS NULL");
			if(($rs = $stmt->process($this->userid, $this->ip)) && $rs->hasNext()) {
				return $this->sendBack(new Message('lout', null, null, 'banned'));
			}
			//autounban user if he was banned from room
			$stmt = new Statement("DELETE FROM {$GLOBALS['fc_config']['db']['pref']}bans WHERE banneduserid=? AND roomid IS NOT NULL");
			$stmt->process($this->userid);
			
			$user = ChatServer::getUser($this->userid);
			
			$ret = $this->doGetLanguage($this->lang);
			
			$this->sendBack(new Message('lin', $this->userid, $user['roles'], $this->lang));

			//Send room list to user
			$rooms = array(); 
			if(ChatServer::userInRole($this->userid, ROLE_CUSTOMER)) {
				$this->roomid = $this->doCreateRoom("Support Room for {$user['login']}", true);

				$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE id=?");
				if(($rs = $stmt->process()) && ($rec = $rs->next($this->roomid))) {
					$this->sendBack(new Message('adr', null, $rec['id'], $rec['name']));
					if( $rec['password'] != '' ) $this->sendBack(new Message('srl', null, $rec['id'], 'true'));
					$rooms[$rec['id']] = 0;
				}
			} else {
				$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL AND ispermanent IS NOT NULL ORDER BY ispermanent");
				if($rs = $stmt->process()) {
					while($rec = $rs->next()) {
						$this->sendBack(new Message('adr', null, $rec['id'], $rec['name']));
						if( $rec['password'] != '' ) $this->sendBack(new Message('srl', null, $rec['id'], 'true'));
						$rooms[$rec['id']] = 0;
					}
				}

				$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL AND ispermanent IS NULL ORDER BY created");
				if($rs = $stmt->process()) {
					while($rec = $rs->next()) {
						$this->sendBack(new Message('adr', null, $rec['id'], $rec['name']));
						if( $rec['password'] != '' ) $this->sendBack(new Message('srl', null, $rec['id'], 'true'));
						$rooms[$rec['id']] = 0;
					}
				}
			}

			//Send user list to user
			$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE id<>? AND userid IS NOT NULL");
			if($rs = $stmt->process($this->id)) {
				if($GLOBALS['fc_config']['enableBots']) 
				{
					$bots = $GLOBALS['fc_config']['bot']->getBots();
				}	

				while($rec = $rs->next()) {
					$user = ChatServer::getUser($rec['userid']);
					$spy = ChatServer::userInRole($rec['userid'], ROLE_SPY);
					if($user && !$spy) {
						if(!$GLOBALS['fc_config']['liveSupportMode'] || !ChatServer::userInRole($this->userid, ROLE_CUSTOMER) || ChatServer::userInRole($rec['userid'], ROLE_ADMIN)) {
							
							if(!isset($rooms[$rec['roomid']])) $rooms[$rec['roomid']] = 0;
							$rooms[$rec['roomid']] += 1;
							
							$this->sendBack(new Message('adu', $rec['userid'], $rec['roomid'], $user['login']));
							$this->sendBack(new Message('uclc', $rec['userid'], null, $rec['color']));
							$this->sendBack(new Message('ustc', $rec['userid'], null, $rec['state']));
							
							//send bot avatar
							if($rec['userid'] < 0)
							{
								$in_rec = array();
								$in_rec['id'] = $rec['id'];
								$conn =& ChatServer::getConnection($in_rec);
								$conn->doSendAvatar('mavt', $bots[$rec['userid']]['chat_avatar'], 0);
								$conn->doSendAvatar('ravt', $bots[$rec['userid']]['room_avatar'], 0);
							}
						}
					}
				}
			}
			
			$user = ChatServer::getUser($this->userid);
			
			//Warn all users about new user
			if($rooms[$this->roomid] >= $GLOBALS['fc_config']['maxUsersPerRoom'])
			{
				foreach(array_keys($rooms) as $room)
				{
					if($rooms[$room] < $GLOBALS['fc_config']['maxUsersPerRoom'])
					{
						$this->roomid = $room;
						break;
					}
				}
				if($this->roomid <> $room || count($rooms) == 1) 
				{
					return $this->sendBack(new Message('lout', null, null, 'chatfull'));
				}
			}
			
			$this->sendToAll(new Message('adu', $this->userid, $this->roomid, $user['login'], null));
			$this->sendToAll(new Message('uclc', $this->userid, null, $this->color));
			$this->sendToAll(new Message('ustc', $this->userid, null, $this->state));

			//Update ingonre state
			$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}ignors WHERE userid=?");
			if($rs = $stmt->process($this->userid)) {
				while($rec = $rs->next()) {
					$this->sendBack(new Message('ignu', $rec['ignoreduserid']));
				}
			}

			if($GLOBALS['fc_config']['backtimeOnLogin']) $this->doBacktime($GLOBALS['fc_config']['backtimeOnLogin']);
// fix for /welcome message

			if ($GLOBALS['fc_config']['auto_motd']) {
             include_once(INC_DIR . 'classes/doMotd.php');
			 }
            $destination = null;
  			if ($GLOBALS['fc_config']['auto_topic']) {
				include_once(INC_DIR . 'classes/doRoomEntryInfo.php');
				}

// end fix 
			return $ret;
?>

⌨️ 快捷键说明

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