Jump to content
  • 0

pomoc PHP Form help


Jáá

Dotaz

HTML

<html>

<body>

 

<form action="hladaj.php" method="post">

IP: <input type="text" name="ipserver">

PORT: <input type="text" name="portserver">

<input type="submit">

</form>

 

</body>

</html>

 

PHP

Pôvodne $query = new SampQuery("127.0.0.1", 7777);

 

 

a kde do toho mám doplnit $_POST["ipserver"]; a $_POST["portserver"];

 

http://www.w3schools.com/php/php_forms.asp

http://forum.sa-mp.com/showthread.php?t=355574

 

ak to dám tak to tak to hádže error na tento riadok

$query = new SampQuery("$_POST["ipserver"];", $_POST["portserver"]);

 

neviem ako to do toho mám doplnit poradte pls

Link to comment
Share on other sites

1 odpověd na tuto otázku

Recommended Posts

  • 0
<!DOCTYPE html>
<head>
</head>
<body>
<?php
if (isset($_REQUEST['ipserver']))
 {
 $ip  =  $_POST['ipserver'];
 $port  =  $_POST['portserver'];
 $query  =  '$ip:$port';

	if ($query->connect()) { // If a successful connection has been made

		print_r($query->getInfo()); // Print server info array

		print_r($query->getBasicPlayers()); // Print basic players array, connection will time out if the player counter is above 100 and will return an empty array if no players are online

		$query->close(); // Close the connection
	} else {
		echo "Server did not respond!";
	}

 }
else
 {
 echo '<form method="post" action="hladaj.php">';
 echo 'IP: <input type="text" name="ipserver">';
 echo 'PORT: <input type="text" name="portserver">';
 echo '<input type="submit" value="Submit">';
 echo '</form>';
 }
?>
</body>
</html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...