Jump to content

PHP Parse Error


andrew89898

Recommended Posts

Hello,  I have an error when I try to php a file the error is :

Parse error: syntax error, unexpected T_PUBLIC in ...

on line 959

 

That part looks like this:

public function makeLoginKey($username){
	$username = strtoupper($username);
	$len = strlen($username);
	for($i = 0; $i < $len; $i++){
		if($i %2 == 0){
			$username{$i} = strtolower($username{$i});
		}
	}
	$hash = $this->encryptPassword(base64_encode($username));
	$key = substr(strtolower($hash) . strtoupper($hash), 15 - $len, 40 - $len);
	return strtolower($key);
}

Thanks for help and line 959 is the first line (public function makeloginkey..)

Link to comment
Share on other sites

Hello, I have just fixed that error.

Now I have a new error ,

Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in ... on line 1230

 

The lines look close to 1230 look like this:

1230:if(defined("usekey")){function key_exists($a, $b){

1231return array_key_exists($a, $b);

1232}}

 

Thanks for the help.

 

Link to comment
Share on other sites

	function removeClientBySock($socket){
	//debug_print_backtrace();
	foreach ($this->clients as $key => &$c){
		if($c->sock === $socket){
			$this->removeClient($key);
			return 0;
		}
	}
	return -1;
}
}
if(defined("usekey")){function key_exists($a, $b){
return array_key_exists($a, $b);
}}

Thats the code before it, Thanks for help.

Link to comment
Share on other sites

The lines look like this:

    myErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);

  }

}

 

?>

From the code you've pasted, we can only tell you that you've closed two brackets without opening two brackets.

Link to comment
Share on other sites

Sorry ^^ heres the code of that function, There is too starting brackets.

function fatalErrorShutdownHandler()
{(here)
  $last_error = error_get_last();
  if ($last_error['type'] === E_ERROR) {(here)
    // fatal error
    myErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
  }
}

?>

The "(here" isnt in the code its just showing that there is two brackets.

 

 

Link to comment
Share on other sites

It's a syntax error. You're more than likely missing an opening or closing bracket/quote/param somewhere in that humongous 1273+ line file.  I'd say post it the entire file, but almost no one here is going to go through 1273+ lines of code to find a single syntax error, lol.

 

In your favorite PHP editor, find out if you're opening something you're not closing.

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.