All pastes #538389 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-05 00:39 UTC
rendered paste body
	function DoCommand($c,&$r) {
		if ($this->fp) {
			fputs($this->fp,"$c\r");
			$this->Sleep();
			$this->GetResponse($r);
			$bad_char = "/\r/";
			$r=preg_replace("$bad_char","<br>",$r);
			$r_array=explode("\n",$r);
			$new_r=array();
			foreach($r_array as $line) {
				$to_push=ereg_replace("[^a-zA-Z0-9_.@<>() ]", "", $line);
				array_push($new_r, $to_push);
			}
			$r=implode("", $new_r);
		}
		return $r; 
	}
	
	function GetResponse(&$r) {
		$r='';
		do { 
			$r.=fread($this->fp,1000);
			$s=socket_get_status($this->fp);
		} while ($s['unread_bytes']);
	}