14 Sty 2011, 20:41
.$rekord[1].
.$rekord[3].
<?php
include("polacz.php");
$query = mysql_query("select * from s where id='".(int)$_GET['id']."'"); // 1
$rekord = mysql_fetch_array($query);
$online = '<td><img src="on.jpeg"/></td>' ;
$offline = '<td><img src="off.jpeg"/></td>' ;
function servercheck ( $server , $port ){
if(empty( $port )){
$port = 2080 ;
}
if(empty( $server )){
$server = '.$rekord[1].' ;
}
$fp =@ fsockopen ( $server , $port , $errno , $errstr , 1 );
if( $fp ){
return 1 ;
} else{
return 0 ;
}
fclose ( $fp );
}
$services =array(
'' => array( '.$rekord[1].' => '.$rekord[3].' )
);
?>
<?php
foreach( $services as $name => $server ){
?>
<?php echo $name ; ?>
<?php
foreach( $server as $host => $port ){
if( servercheck ( $host , $port )){ echo $online ; }else{ echo $offline ; }
}
?>
<?php
}
?>
-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Czas wygenerowania: 14 Sty 2011, 19:22
-- Wersja serwera: 5.1.33
-- Wersja PHP: 5.2.12
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Baza danych: `kisiell9`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `s`
--
CREATE TABLE IF NOT EXISTS `s` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` varchar(30) NOT NULL,
`data` datetime NOT NULL,
`port` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin2 AUTO_INCREMENT=3 ;
--
-- Zrzut danych tabeli `s`
--
INSERT INTO `s` (`id`, `ip`, `data`, `port`) VALUES
(1, 'google.pl', '2011-01-14 18:10:30', '80');
<?php
mysql_connect('localhost', 'root' , '');
mysql_select_db("kisiell9");
mysql_query("SET NAMES 'utf8'");
?>
14 Sty 2011, 23:17