Jump to content

PHP Errors Client


andrew89898

Recommended Posts

Hi, I am getting some PHP errors that all originate in one file. Since the file is very small I will post it all:

 

The errors:

PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in C:\Users

\Andrew Hunt\Desktop\REAL ICP SOURCE\PHP\QF\INCLUDES\ClientBase.php at 33!

PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in C:\

Users\Andrew Hunt\Desktop\REAL ICP SOURCE\PHP\QF\INCLUDES\ClientBase.php at 43!

←[32m

[xmlServ:1] ←[33;1m[20:18:46]←[1m ←[37mClient created, ID:3, Socket ID: 0,
rndK: fOa8xht8←[00m
PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in C:\Users
\Andrew Hunt\Desktop\REAL ICP SOURCE\PHP\QF\INCLUDES\ClientBase.php at 33!
PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in C:\
Users\Andrew Hunt\Desktop\REAL ICP SOURCE\PHP\QF\INCLUDES\ClientBase.php at 43!
←[32m[xmlServ:1] ←[33;1m[20:18:46] ←[35;1mMalformed packet <policy-file-request/
>  sent by 0←[00m

The whole file:
<?php
class ClientBase{
static $num = 0;
static $count = 0;
public $properties = array();
public $p = null;
public $sock;
public $parent;
public $room;
public $uniqueid = 0;
public $inGame = false;
public $xpos = 0;
public $ypos = 0;
public $clientID = 0;
public $name = "";

function __construct($sock, $server, $clientid){
	self::$num++;
	self::$count++;
	$this->parent =& $server;
	$this->uniqueid = self::$count;
	$this->sock = $sock;
	$this->p =& $this->properties;//p and properties are for temporary properties.
	$this->p['rndK'] = $this->makeRndK();
	$this->clientID = $clientid;
}

/*function __destruct(){
	self::$num--;
	@socket_close($this->sock);
}*/

//line 33 function write($data, $flags = MSG_EOR){
	$data .= chr(0);
	$sendLen = strlen($data);
	$w = array($this->sock);
	$a = null;
	$b = null;
	$res = @socket_select($a, $w, $b, 0.15);
	if($res === false){
		return $this->parent->removeClient($this->clientid);
	}
	//line 43 $len = @socket_send($this->sock, $data, $sendLen, $flags);
	//$times = 5;
	/*while($len === false && $len < $sendLen){
		if($len === false){
			$ltr = 0;
		}
		else
			$ltr = $len;
		$data = substr($data, $ltr);
		$sendLen = strlen($data);
		$len = @socket_send($this->sock, $data, $sendLen, $flags);
		usleep(2000);
		$times--;
		if($times < 0)
			break;
	}*/
	return $len ? true : false;
}

function makeRndK(){
	$c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxwz0123456789?~";
	$l = rand(6,14);
	$s = "";
	for(;$l > 0;$l--)
		$s .= $c{rand(0,strlen($c) - 1)};
	return $s;
}

function buildClientString($type = "raw", $s = "%"){
	if($type == "xml"){
		return $this->buildXmlPlayer();
	}
	return $this->buildRawPlayer($s);
}

function getSortedProperties(){

}

function buildRawPlayer($s){
	return implode($this->getSortedProperties(), $s);
}

function getSocket(){
	return $this->sock;
}
}
?>

 

Thank you for your help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.