Page 1 of 1

Help and advice on my server status page...

Posted: Sun Apr 01, 2012 9:14 pm
by Smg
ok i have recently used jaceks server status page tutorial... And i was wondering if anyone could help me make it where
when you see the servers, you can click the servers name and it will have their own custom page with info about it and the ability for people to post their own servers. please if anyone can help can they show me what i should do with codes to figure this out thank you.

here are my codes:
status.php:
[syntax=php]<?php

include('core/init.inc.php');

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table { width: 600px; border-collapse: collapse; background: #fff; }
td, th { padding: 4px; border: solid 1px #444; }
.online { background: #090; }
.offline { background: #900; }
a { color: white; }
</style>
<title>Server Status</title>
</head>
<body background="ext/images/background.jpg">
<center>
<?php
if (fetch_user_rank() == 1) {
// give permission
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="admin.php"><img src="ext/images/admin.jpg" width="94" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
} else {
//redirect them
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
}
?><br />
<br />
<?php
header("refresh:30;url=status.php");
echo '<font color="white">This page refreshes in about 30 secs. If not, click <a href="status.php">here</a>.</font>';
?>
</center><br />
<center><table>
<thead>
<tr>
<th>Server IP</th>
<th>Server Port</th>
<th>Server Status</th>
</tr>
</thead>
<tbody>
<?php

foreach ($servers as $server){
$online = server_online($server[0], $server[1]);

?>
<tr>
<td align="center"><?php echo $server[0]; ?></td>
<td align="center"><?php echo $server[1]; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
</tr>
<?php
}

?>
</tbody>
</table></center>
</body>
</html>[/syntax]

server.inc.php:
[syntax=php]<?php

// checks if server is online
function server_online($server, $port){
fsockopen($server, $port, $errno, $errstr, 0.1);

return ($errno === 0);
}

?>[/syntax]

init.inc.php:
[syntax=php]$servers = array(
array('127.0.0.1', '25586'),
array('127.0.0.1', '43594'),
array('127.0.0.1', '43594'),
array('127.0.0.1', '43594'),
);[/syntax]

Re: Help and advice on my server status page...

Posted: Sun Apr 01, 2012 10:50 pm
by Temor
You could create a new php page called view_server.php or something. You would need to get a database set up for this also. Store the servers in a database along with an ID.
Then retrieve the id from the database and echo it out like this:
[syntax=php]
<?php
foreach ($servers as $server){
$online = server_online($server[0], $server[1]);
?>
<a href="view_server.php?id=<?php echo $server['id']; ?>"><?php echo $server['name']; ?></a>
<?php
}
[/syntax]

You would then code view_server.php to fetch the $_GET['id'] variable and pick information from the database that belongs to that id.

And for the user upload thing you would have to create a form where the user has to input server name, ip and port or whatever else information you need and insert that into your database.

Let me know if you need more specific help with something.

Re: Help and advice on my server status page...

Posted: Sun Apr 01, 2012 10:53 pm
by Smg
ok i have added 4 columns in the table server status...
server_id - auto increment
server_name - varchar 50
server_ip - varchar 50
server_port - varchar 50

also i made a server pagination and heres is what i have so far and also the server status always shows online how do i fix this problem?

server.inc.php
[syntax=php]<?php

// checks if server is online
function server_online($server, $port){
fsockopen($server, $port, $errno, $errstr, 0.1);

return ($errno === 0);
}

function fetch_servers($page, $per_page){

$start = (int)($page - 1) * $per_page;
$per_page = (int)$per_page;
$result = mysql_query("SELECT `server_id` AS `id`, `server_name` AS `name`, `server_ip` AS `ip`, `server_port` AS `port` FROM `server_status` LIMIT {$start}, {$per_page}");

$servers = array();

while (($row = mysql_fetch_assoc($result)) !== false){
$servers[] = $row;
}

return $servers;
}

function fetch_total_servers(){
$result = mysql_query('SELECT COUNT(`server_id`) FROM `server_status`');

return mysql_result($result, 0);
}

?>[/syntax]

status.php
[syntax=php]<center><table>
<thead>
<tr>
<th>Server Name</th>
<th>Server IP</th>
<th>Server Port</th>
<th>Server Status</th>
</tr>
</thead>
<tbody>
<?php

foreach (fetch_servers($page, 5) as $server){
$online = server_online($server[0], $server[1]);

?>
<tr>
<td align="center"><?php echo $server['name']; ?></td>
<td align="center"><?php echo $server['ip']; ?></td>
<td align="center"><?php echo $server['port']; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
</tr>
<?php
}

?>
</tbody>
</table>
<br />
<center>
<?php

$total_pages = ceil(fetch_total_users() / 5);

for ($i = 1; $i <= $total_pages; ++$i){
echo " <a href=\"?page={$i}\">{$i}</a> ";
}
?>
</center></center>[/syntax]

Re: Help and advice on my server status page...

Posted: Sun Apr 01, 2012 11:19 pm
by Temor
Smg wrote:so your saying ill have to add into the database id, servername, ip, and port?

Yes, unless there's anything else you need or want, like a description.
The id will be automatically generated for you if you make the field auto-increment, so you wont actually need to add that in yourself.

Re: Help and advice on my server status page...

Posted: Sun Apr 01, 2012 11:25 pm
by Smg
ok now i have quite a bit of errors...

here is my code:

view_server.php: ERROR = it always says offline
[syntax=php]<?php

include('core/init.inc.php');

$server_info = fetch_server_info($_GET['id']);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table { width: 765px; border-collapse: collapse; background: #fff; }
td, th { padding: 4px; border: solid 1px #444; }
.online { background: #090; }
.offline { background: #900; }
a { color: white; }
</style>
<title><?php echo $server_info['name']; ?>'s Status</title>
</head>
<body>
<body background="ext/images/background.jpg">
<center>
<?php
if (fetch_user_rank() == 1) {
// give permission
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="admin.php"><img src="ext/images/admin.jpg" width="94" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
} else {
//redirect them
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
}
?>
</center>
<center>
<?php
if ($server_info === false){
echo '<br /><br /><br /><table><th><font color="red">The server status page you requested does not exist!</font></th></table>';
} else {
header("refresh:30;");
echo '<br /><font color="white">This page refreshes in about 30 secs.</font><br /><br />';
?>
</center>
<center>
<table>
<thead>
<tr>
<th>Server Owner</th>
<th>Server Type</th>
<th>Server Name</th>
<th>Server IP</th>
<th>Server Port</th>
<th>Server Status</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><?php echo $server_info['owner']; ?></td>
<td align="center"><?php echo $server_info['type']; ?></td>
<td align="center"><?php echo $server_info['name']; ?></td>
<td align="center"><?php echo $server_info['ip']; ?></td>
<td align="center"><?php echo $server_info['port']; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
</tr>
<tr>
<td align="center" colspan="6"><?php echo $server_info['about']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table></center>
</body>
</html>[/syntax]

status.php: ERROR = always says online
[syntax=php]<?php

include('core/init.inc.php');

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table { width: 600px; border-collapse: collapse; background: #fff; }
td, th { padding: 4px; border: solid 1px #444; }
.online { background: #090; }
.offline { background: #900; }
a { color: white; }
</style>
<title>Server Status</title>
</head>
<body background="ext/images/background.jpg">
<center>
<?php
if (fetch_user_rank() == 1) {
// give permission
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="admin.php"><img src="ext/images/admin.jpg" width="94" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
} else {
//redirect them
echo '<a href="index.php"><img src="ext/images/home.jpg" width="93" height="27" alt=""></a><a href="user_list.php"><img src="ext/images/members.jpg" width="134" height="27" alt=""></a><a href="status.php"><img src="ext/images/serverstatus.jpg" width="220" height="27" alt=""></a><a href="file_list.php"><img src="ext/images/files.jpg" width="76" height="27" alt=""></a><a href="edit_profile.php"><img src="ext/images/editprofile.jpg" width="176" height="27" alt=""></a><a href="logout.php"><img src="ext/images/logout.jpg" width="123" height="27" alt=""></a>';
}
?><br />
<br />
<?php
echo '<p><font color="white">Do you want to <a href="add_server.php">Make a Server Status Page?</a></font></p>';
?>
</center><br />
<center><table>
<thead>
<tr>
<th>Server Owner</th>
<th>Server Name</th>
<th>Server Version</th>
<th>Server Type</th>
<th>Server Status</th>
</tr>
</thead>
<tbody>
<?php

foreach (fetch_servers($page, 5) as $server){
$online = server_online($server[0], $server[1]);

?>
<tr>
<td align="center"><?php echo $server['owner']; ?></td>
<td align="center"><a href="view_server.php?id=<?php echo $server['id']; ?>"><font color="black"><?php echo $server['name']; ?></font></a></td>
<td align="center"><?php echo $server['version']; ?></td>
<td align="center"><?php echo $server['type']; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
</tr>
<?php
}

?>
</tbody>
</table>
<br />
<center>
<?php

$total_pages = ceil(fetch_total_servers() / 5);

for ($i = 1; $i <= $total_pages; ++$i){
echo " <a href=\"?page={$i}\">{$i}</a> ";
}
?>
</center></center>
</body>
</html>[/syntax]

server.inc.php: Error = not sure i think it has to do with server_online <= that function && function fetch_server_info()
[syntax=php]<?php

// checks if server is online
function server_online($server, $port){
fsockopen($server, $port, $errno, $errstr, 0.1);

return ($errno === 0);
}

function fetch_servers($page, $per_page){

$start = (int)($page - 1) * $per_page;
$per_page = (int)$per_page;
$result = mysql_query("SELECT `server_id` AS `id`, `server_owner` AS `owner`, `server_type` AS `type`, `server_version` AS `version`, `server_name` AS `name`, `server_ip` AS `ip`, `server_port` AS `port` FROM `server_status` LIMIT {$start}, {$per_page}");

$servers = array();

while (($row = mysql_fetch_assoc($result)) !== false){
$servers[] = $row;
}

return $servers;
}

function fetch_total_servers(){
$result = mysql_query('SELECT COUNT(`server_id`) FROM `server_status`');

return mysql_result($result, 0);
}

function server_name_exists($server_name){
$server_name = mysql_real_escape_string($server_name);

$total = mysql_query("SELECT COUNT(`server_id`) FROM `server_status` WHERE `server_name` = '{$server_name}'");

return (mysql_result($total, 0) == '1') ? true : false;
}

function server_ip_exists($server_ip){
$server_ip = mysql_real_escape_string($server_ip);

$total = mysql_query("SELECT COUNT(`server_id`) FROM `server_status` WHERE `server_ip` = '{$server_ip}'");

return (mysql_result($total, 0) == '1') ? true : false;
}

function add_server($server_owner, $server_type, $server_version, $server_name, $server_ip, $server_port, $server_about){
$server_owner = $_POST['server_owner'];
$server_type = $_POST['server_type'];
$server_version = $_POST['server_version'];
$server_name = $_POST['server_name'];
$server_ip = $_POST['server_ip'];
$server_port = $_POST['server_port'];
$server_about = $_POST['server_about'];

$insert = 'INSERT into server_status(server_owner, server_type, server_version, server_name, server_ip, server_port, server_about) VALUES ("'. $server_owner .'", "'. $server_type .'", "'. $server_version .'", "'. $server_name .'", "'. $server_ip .'", "'. $server_port .'", "'. $server_about .'")';

mysql_query($insert);
}

function fetch_server_info($id){
$id = (int)$id;

$sql = "SELECT
`server_id` AS `id`,
`server_owner` AS `owner`,
`server_type` AS `type`,
`server_version` AS `version`,
`server_name` AS `name`,
`server_ip` AS `ip`,
`server_port` AS `port`,
`server_about` AS `about`
FROM `server_status`
WHERE `server_id` = {$id}";

$result = mysql_query($sql);

return $result;
}

?>[/syntax]

PS
i was able to make add_server.php to work the ones above i need help with. :\

Re: Help and advice on my server status page...

Posted: Tue Apr 03, 2012 1:55 am
by jacek
Smg wrote:ok i have added 4 columns in the table server status...
server_id - auto increment
server_name - varchar 50
server_ip - varchar 50
server_port - varchar 50

50 characters is deceptively long ~30 should be more than enough for the server_name. The server IP will never be longer than 15 characters since there are 4 blocks of 3 numbers and 3 periods. the server_post should not be a string type since it's not a string, it should be an integer of length 6 (maybe 5, go check the highest possible port number)

Some other general tips
  • You should avoid outputting huge chunks of HTML with echo, it makes it very hard to format things properly
  • You should not use $_POST directly in a function, the point of a function is that is should be reusable by using $_POST as you do you restrict it's use to a very specific form submission.
  • you need to look up SQL injection since the add_user function is vulnerable, I did mention this in the video multiple times :?
  • You should really try to style things with CSS more, and not use non-standard html attributes and tags.

Re: Help and advice on my server status page...

Posted: Tue Apr 03, 2012 6:38 am
by bowersbros
Doesn't IPv6 use 32 characters though? So, having it available for longer addresses is a good idea, since they will be arriving not too far away.

Re: Help and advice on my server status page...

Posted: Tue Apr 03, 2012 7:33 pm
by jacek
bowersbros wrote:Doesn't IPv6 use 32 characters though? So, having it available for longer addresses is a good idea, since they will be arriving not too far away.

You have to confuse things don't you. It's probably not the worst idea to support ipv6, but you can always change it later if needed.

Re: Help and advice on my server status page...

Posted: Tue Apr 03, 2012 11:27 pm
by Smg
ok i have fixed mainly everything but the hard part is now the function server_online()
does not show the status of the server it has been requested for... so how would i make function server_online()
grab the ip and port from the mysql database and show if it is online or not? and if you can can you give me a code example

Re: Help and advice on my server status page...

Posted: Thu Apr 05, 2012 1:06 pm
by jacek
Instead of having the function fetch the information form the database you should fetch the info with another function and then use it with the check function.

Something like what you have actually

[syntax=php]foreach (fetch_servers($page, 5) as $server){
$online = server_online($server[0], $server[1]);
}[/syntax]

Re: Help and advice on my server status page...

Posted: Fri Apr 06, 2012 8:03 pm
by Smg
ok i am currently confused about this and how in 'code' would i make this function like what should be in it? and also i need for the function to grab the ip from the database because the ip and port are stored into the database. Thanks, Smg.

Re: Help and advice on my server status page...

Posted: Fri Apr 06, 2012 11:49 pm
by jacek
You already have it :? you posted the fetch_server() function above. Or am I missing something.

Re: Help and advice on my server status page...

Posted: Sat Apr 07, 2012 5:35 pm
by Smg
Ok I have 2 php pages that should be able to show online and offline one is view_server.php this page shows the servers info
The other one is status.php which shows a list of all servers but they don't show online or offline they're always offline so how would I make a function that grabs the ip and port from the database to properly show online and offline?
Also how would I put the code to show if it works or not?

Re: Help and advice on my server status page...

Posted: Sun Apr 08, 2012 1:09 am
by jacek
Ah okay, well it looks like the way you are doing it is right. The only problem I can see is that you are using mysql_fetch_assoc() and then trying to use numeric keys to access the array.

Try using the column names instead, so

[syntax=php] $online = server_online($server[0], $server[1]);[/syntax]
would be

[syntax=php] $online = server_online($server['ip'], $server['port']);[/syntax]
You might also need to increase the timeout used in the fsockopen function a bit. 0.5 should be more than enough to make sure the connection is still made to a laggy server.

Re: Help and advice on my server status page...

Posted: Sun Apr 08, 2012 7:39 pm
by Smg
ok i did what you said and it just shows offline and when i put a server that is online it shows online but when ... and when i go to view_server.php it always says online when its offline what should i do to fix this?

status.php:
[syntax=php]<center><table>
<thead>
<tr>
<th>Server Owner</th>
<th>Server Name</th>
<th>Server Version</th>
<th>Server Type</th>
<th>Server Status</th>
<th>Check Server</th>
</tr>
</thead>
<tbody>
<?php

foreach (fetch_servers($page, 5) as $server){
$online = server_online($server['ip'], $server['port']);

?>
<tr>
<td align="center"><?php echo $server['owner']; ?></td>
<td align="center"><?php echo $server['name']; ?></td>
<td align="center"><?php echo $server['version']; ?></td>
<td align="center"><?php echo $server['type']; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
<td align="center"><a href="view_server.php?id=<?php echo $server['id']; ?>"><img src="ext/images/go.jpg" /></a></td>
</tr>
<?php
}

?>
</tbody>
</table>[/syntax]

and view_server.php:
[syntax=php] <table>
<thead>
<tr>
<th>Server Owner</th>
<th>Server Type</th>
<th>Server Name</th>
<th>Server IP</th>
<th>Server Port</th>
<th>Server Status</th>
</tr>
</thead>
<tbody>
<?php
$online = server_online($server['ip'], $server['port']);
?>
<tr>
<td align="center"><?php echo $server_info['owner']; ?></td>
<td align="center"><?php echo $server_info['type']; ?></td>
<td align="center"><?php echo $server_info['name']; ?></td>
<td align="center"><?php echo $server_info['ip']; ?></td>
<td align="center"><?php echo $server_info['port']; ?></td>
<td align="center" class="<?php echo ($online) ? 'online' : 'offline'; ?>"><?php echo ($online) ? 'Online' : 'Offline'; ?></td>
</tr>
<tr>
<td align="center" colspan="6"><?php echo $server_info['about']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>[/syntax]

and servers.inc.php:
[syntax=php]
<?php

// checks if server is online
function server_online($server, $port){
fsockopen($server, $port, $errno, $errstr, 0.5);

return ($errno === 0);
}

function fetch_servers($page, $per_page){

$start = (int)($page - 1) * $per_page;
$per_page = (int)$per_page;
$result = mysql_query("SELECT `server_id` AS `id`, `server_owner` AS `owner`, `server_type` AS `type`, `server_version` AS `version`, `server_name` AS `name`, `server_ip` AS `ip`, `server_port` AS `port` FROM `server_status` LIMIT {$start}, {$per_page}");

$servers = array();

while (($row = mysql_fetch_assoc($result)) !== false){
$servers[] = $row;
}

return $servers;
}

function fetch_total_servers(){
$result = mysql_query('SELECT COUNT(`server_id`) FROM `server_status`');

return mysql_result($result, 0);
}

function server_name_exists($server_name){
$server_name = mysql_real_escape_string($server_name);

$total = mysql_query("SELECT COUNT(`server_id`) FROM `server_status` WHERE `server_name` = '{$server_name}'");

return (mysql_result($total, 0) == '1') ? true : false;
}

function server_ip_exists($server_ip){
$server_ip = mysql_real_escape_string($server_ip);

$total = mysql_query("SELECT COUNT(`server_id`) FROM `server_status` WHERE `server_ip` = '{$server_ip}'");

return (mysql_result($total, 0) == '1') ? true : false;
}

function add_server($server_owner, $server_type, $server_version, $server_name, $server_ip, $server_port, $server_about){
$server_owner = $_POST['server_owner'];
$server_type = $_POST['server_type'];
$server_version = $_POST['server_version'];
$server_name = $_POST['server_name'];
$server_ip = $_POST['server_ip'];
$server_port = $_POST['server_port'];
$server_about = $_POST['server_about'];

$insert = 'INSERT into server_status(server_owner, server_type, server_version, server_name, server_ip, server_port, server_about) VALUES ("'. $server_owner .'", "'. $server_type .'", "'. $server_version .'", "'. $server_name .'", "'. $server_ip .'", "'. $server_port .'", "'. $server_about .'")';

mysql_query($insert);
}

function fetch_server_info($sid){
$sid = (int)$sid;

$sql = "SELECT
`server_id` AS `id`,
`server_owner` AS `owner`,
`server_type` AS `type`,
`server_version` AS `version`,
`server_name` AS `name`,
`server_ip` AS `ip`,
`server_port` AS `port`,
`server_about` AS `about`
FROM `server_status`
WHERE `server_id` = {$sid}";

$result = mysql_query($sql);

return mysql_fetch_assoc($result);
}

?>[/syntax]

Re: Help and advice on my server status page...

Posted: Tue Apr 10, 2012 3:38 pm
by jacek
Hmm, can you try turning error_reporting back on ? the connection might be failing for the wrong reason. Just post back what the error is form the fsockopen() function on both pages (if there is one).

Also, you still need to fix the add_server() function ;)

could you also post an example of the data form the table ?

Re: Help and advice on my server status page...

Posted: Fri Apr 13, 2012 11:14 pm
by Smg
ok there is no fsockopen function on those two pages its just the tutorial you gave on the server status page i did and now its not working because i tried to make it grab the ip and port from the database and also when i try to make the add_server() function secure it doesnt put all of the info into the correct places on the page so i am not sure how to make it secure...

Re: Help and advice on my server status page...

Posted: Sun Apr 15, 2012 1:11 pm
by jacek
Smg wrote:ok there is no fsockopen function on those two pages its just the tutorial you gave on the server status page i did and now its not working because i tried to make it grab the ip and port from the database and also when i try to make the add_server() function secure it doesnt put all of the info into the correct places on the page so i am not sure how to make it secure...

The fsockopen function is in the server_online() function and that is called on both of the pages. You don't want to have to server_online function take anything from the database directly. Maybe try printing the server IP and port before you check it to make sure that you are using the right data ?

As for the security thing, post your code :)