ftp_base::SetServer() –
You appear to be a bot. Output may be restricted
Description
Usage
ftp_base::SetServer( $host, $port, $reconnect );
Parameters
- $host
- ( mixed ) required –
- $port
- ( mixed ) optional default: 21 –
- $reconnect
- ( mixed ) optional default: 1 –
Returns
void
Source
File name: wordpress/wp-admin/includes/class-ftp.php
Lines:
1 to 32 of 32
function SetServer($host, $port=21, $reconnect=true) { if(!is_long($port)) { $this->verbose=true; $this->ftp_base::SendMSG("Incorrect port syntax"); return FALSE; } else { $ip=@gethostbyname($host); $dns=@gethostbyaddr($host); if(!$ip) $ip=$host; if(!$dns) $dns=$host; // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid $ipaslong = ip2long($ip); if ( ($ipaslong == false) || ($ipaslong === -1) ) { $this->ftp_base::SendMSG("Wrong host name/address \"".$host."\""); return FALSE; } $this->_host=$ip; $this->_fullhost=$dns; $this->_port=$port; $this->_dataport=$port-1; } $this->ftp_base::SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\""); if($reconnect){ if($this->_connected) { $this->ftp_base::SendMSG("Reconnecting"); if(!$this->ftp_base::quit(FTP_FORCE)) return FALSE; if(!$this->ftp_base::connect()) return FALSE; } } return TRUE; }