[Tool/Web/Other] [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010)
#41

Do You guys know, for how long does the script is trying to connect to the server ?
I'm using this script for little server panel, and when the server is down, each page is loading very slowly.
Or is there any way to time the check function ?
Regards, Sim00n.
Reply
#42

Links was Dead
Reply
#43

Well done. The links should be online in about two hours or so, methinks.
Reply
#44

Westie, why SAMPQueryAPI doenst work?
Reply
#45

Quote:
Originally Posted by Typhome
Посмотреть сообщение
Westie, why SAMPQueryAPI doenst work?
Gee, I have no idea! Why doesn't it work for you?
Reply
#46

Link is Dead! Please upload it again!
Reply
#47

Quote:
Originally Posted by Shinoda90
Посмотреть сообщение
Link is Dead! Please upload it again!
Link [DEAD]
please.
Reply
#48

Код:
<html>
<body>

<?php

require "SampQueryAPI.php";
$query = new SampQueryAPI(192.168.1.109', '7777');


if($query->isOnline())
{
	$aInformation = $query->getInfo();
	$aServerRules = $query->getRules();
	
	?>
	<b>General Information</b>
	<table width="400">
		<tr>
			<td>Hostname</td>
			<td><?= htmlentities($aInformation['hostname']) ?></td>
		</tr>
		<tr>
			<td>Gamemode</td>
			<td><?= htmlentities($aInformation['gamemode']) ?></td>
		</tr>
		<tr>
			<td>Players</td>
			<td><?= $aInformation['players'] ?> / <?= $aInformation['maxplayers'] ?></td>
		</tr>
		<tr>
			<td>Map</td>
			<td><?= htmlentities($aInformation['mapname']) ?></td>
		</tr>
		<tr>
			<td>Weather</td>
			<td><?= $aServerRules['weather'] ?></td>
		</tr>
		<tr>
			<td>Time</td>
			<td><?= $aServerRules['worldtime'] ?></td>
		</tr>
		<tr>
			<td>Version</td>
			<td><?= $aServerRules['version'] ?></td>
		</tr>
		<tr>
			<td>Password</td>
			<td><?= $aInformation['password'] ? 'Yes' : 'No' ?></td>
		</tr>
	</table>

	<br />
	<b>Online Players</b>
	<?php
	
	$aPlayers = $query->getDetailedPlayers();
	
	if(!is_array($aPlayers) || count($aPlayers) == 0)
	{
		echo '<br /><i>None</i>';
	}
	else
	{
		?>
		<table width="400">
			<tr>
				<td><b>Player ID</b></td>
				<td><b>Nickname</b></td>
				<td><b>Score</b></td>
				<td><b>Ping</b></td>
			</tr>
		<?php
		foreach($aPlayers as $sValue)
		{
			?>
			<tr>
				<td><?= $sValue['playerid'] ?></td>
				<td><?= htmlentities($sValue['nickname']) ?></td>
				<td><?= $sValue['score'] ?></td>
				<td><?= $sValue['ping'] ?></td>
			</tr>
			<?php
		}
	
		echo '</table>';
	}
}
?>

</body>
</html>
The ip is my pc's ip.. i have also tried my public ip... still no luck. WHAT SHOULD I DO
Reply
#49

I have a problem here,

This is what I get on my website
Код:
isOnline()) { $aInformation = $query->getInfo(); $aServerRules = $query->getRules(); ?> General Information
Hostname 	
Gamemode 	
Players 	/
Map 	
Weather 	
Time 	
Version 	
Password 	

Online Players getDetailedPlayers(); if(!is_array($aPlayers) || count($aPlayers) == 0) { echo '
None'; } else { ?> '; } } ?>
Player ID 	Nickname 	Score 	Ping
This is what my Code looks like
Код HTML:
<html>
<body>

<?php

require "SampQueryAPI.php";
$query = new SampQueryAPI(188.138.79.5', '6600');


if($query->isOnline())
{
	$aInformation = $query->getInfo();
	$aServerRules = $query->getRules();
	
	?>
	<b>General Information</b>
	<table width="400">
		<tr>
			<td>Hostname</td>
			<td><?= htmlentities($aInformation['hostname']) ?></td>
		</tr>
		<tr>
			<td>Gamemode</td>
			<td><?= htmlentities($aInformation['gamemode']) ?></td>
		</tr>
		<tr>
			<td>Players</td>
			<td><?= $aInformation['players'] ?> / <?= $aInformation['maxplayers'] ?></td>
		</tr>
		<tr>
			<td>Map</td>
			<td><?= htmlentities($aInformation['mapname']) ?></td>
		</tr>
		<tr>
			<td>Weather</td>
			<td><?= $aServerRules['weather'] ?></td>
		</tr>
		<tr>
			<td>Time</td>
			<td><?= $aServerRules['worldtime'] ?></td>
		</tr>
		<tr>
			<td>Version</td>
			<td><?= $aServerRules['version'] ?></td>
		</tr>
		<tr>
			<td>Password</td>
			<td><?= $aInformation['password'] ? 'Yes' : 'No' ?></td>
		</tr>
	</table>

	<br />
	<b>Online Players</b>
	<?php
	
	$aPlayers = $query->getDetailedPlayers();
	
	if(!is_array($aPlayers) || count($aPlayers) == 0)
	{
		echo '<br /><i>None</i>';
	}
	else
	{
		?>
		<table width="400">
			<tr>
				<td><b>Player ID</b></td>
				<td><b>Nickname</b></td>
				<td><b>Score</b></td>
				<td><b>Ping</b></td>
			</tr>
		<?php
		foreach($aPlayers as $sValue)
		{
			?>
			<tr>
				<td><?= $sValue['playerid'] ?></td>
				<td><?= htmlentities($sValue['nickname']) ?></td>
				<td><?= $sValue['score'] ?></td>
				<td><?= $sValue['ping'] ?></td>
			</tr>
			<?php
		}
	
		echo '</table>';
	}
}
?>

</body>
</html>
Any one that can help me out?
Reply
#50

Do you have PHP installed?
Reply
#51

Quote:
Originally Posted by sciman001
Посмотреть сообщение
Код:
$query = new SampQueryAPI(192.168.1.109', '7777');
You haven't made it a string.

Код:
$query = new SampQueryAPI('192.168.1.109', '7777');
Fixed!
Reply
#52

Not working

Parse error: syntax error, unexpected T_DNUMBER in /home/fmodding/public_html/query/jura1.php on line 7


Edit: Now I get white screen only
Reply
#53

No, it does work. It'd help if I knew what the problem was though.
Reply
#54

Aha

getting now that

Notice: fwrite() [function.fwrite]: send of 15 bytes failed with errno=1 Operation not permitted in /home/fmodding/public_html/query/SampQueryAPI.php on line 61
Reply
#55

Your host has disabled sockets.
Reply
#56

Quote:
Originally Posted by Slice
Посмотреть сообщение
Do you have PHP installed?
Of Course I have
Reply
#57

i have this same issue.. and it kinda pisses me off... i am using wanp-server... and i kinda need this to work... Once i find my pass to my hosting.. ill try it there. BUT, if someone could like... help us with this.. that would b great. maybe someone could give a tutorial THAT ACTUALLY WORKS... anyway.. yeah. THX...
Reply
#58

Quote:
Originally Posted by sciman001
Посмотреть сообщение
i have this same issue.. and it kinda pisses me off... i am using wanp-server... and i kinda need this to work... Once i find my pass to my hosting.. ill try it there. BUT, if someone could like... help us with this.. that would b great. maybe someone could give a tutorial THAT ACTUALLY WORKS... anyway.. yeah. THX...
My tutorial does work. Once again, your PHP instance may disable sockets - the answer is to enable sockets!

Edit: Oh, I've found your topic: https://sampforum.blast.hk/showthread.php?tid=250884

Next time, read the first post. You need to enter in your own server IP and port.
Reply
#59

Quote:
Originally Posted by Sascha
View Post
could you specify this?^^ (tell me how)
UDP port open ?

Edit: http://php.net/manual/en/function.fsockopen.php
Reply
#60

how can I check that? (any php code or so? -- using cpanel)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)