Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: online/offline list'as

Parašė Lordcraft· 2007 Lap. 29 02:11:05
#1

Daleiskim turiu koda kuri rasau php-fusion i pridetini psl ir rodo serverio statusa:

<?php
$host = 'google.lt';
$port = '80';

function onlineIndicator($host ,$port){
$online=false;

$fp = @fsockopen($host, $port, $errno, $errstr, 1);
if($fp) {
$online=true;
}

if ($online){
return 'online';
} else {
return 'offline';
}
}
echo onlineIndicator($host,$port);
?>




ir su tuo kodu man reikia sukurti lentele. va scriptas:

   <tr>
<td>
<center><TABLE BORDER="" CELLSPACING="" CELLPADDING="" WIDTH="400" HEIGHT="" ALIGN="" VALING="" BGCOLOR="" BORDERCOLOR="" BACKGROUND="">
<CAPTION ALIGN=""></CAPTION>
<TR ALIGN="" VALIGN="" BGCOLOR="" BORDERCOLOR="">
<TD WIDTH="100" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>Name</b></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>IP/http://www</b></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>STATUS</b></center></TD>
</tr>

<TD WIDTH="" HEIGHT="" ALIGN="left" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center<b>GOOGLE</center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><a href=http://google.lt target='main'> <strong>google.lt</strong></a></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center>
<?php
$host = 'google.lt';
$port = '80';

function onlineIndicator($host ,$port){
$online=false;

$fp = @fsockopen($host, $port, $errno, $errstr, 1);
if($fp) {
$online=true;
}

if ($online){
return 'online';
} else {
return 'offline';
}
}
echo onlineIndicator($host,$port);
?>
</center></TD>
</tr>

</table></center></br>
</td>
</tr>




bek kai parasau ta koda pora kartu kad gautusi lentele man meta error nes kaip suprantu dvieju php negali buti. kaip padaryti kad vienam scripte butu galima surasyti daug ip / www ir portu kad rodytu juos online arba offline ?

Redagavo Lordcraft· 2007 Lap. 29 05:11:05

Parašė Creatium· 2007 Lap. 29 19:11:01
#2

Paprasciausiai turbut butu per iframe idet

Parašė Rytis· 2007 Lap. 29 20:11:04
#3

tikrai ne iframe :)
 <?php
function onlineIndicator($host ,$port){
$online=false;

$fp = @fsockopen($host, $port, $errno, $errstr, 1);
if($fp) {
$online=true;
}

if ($online){
return 'online';
} else {
return 'offline';
}
}
?><tr>
<td>
<center><TABLE BORDER="" CELLSPACING="" CELLPADDING="" WIDTH="400" HEIGHT="" ALIGN="" VALING="" BGCOLOR="" BORDERCOLOR="" BACKGROUND="">
<CAPTION ALIGN=""></CAPTION>
<TR ALIGN="" VALIGN="" BGCOLOR="" BORDERCOLOR="">
<TD WIDTH="100" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>Name</b></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>IP/http://www</b></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><b>STATUS</b></center></TD>
</tr>

<TD WIDTH="" HEIGHT="" ALIGN="left" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center<b>GOOGLE</center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><a href=http://google.lt target='main'> <strong>google.lt</strong></a></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center>
<?php
echo onlineIndicator('google.lt', 80);
?>
</center></TD>




<TD WIDTH="" HEIGHT="" ALIGN="left" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center<b>YAHOO</center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><a href=http://yahoo.com target='main'> <strong>yahoo.com</strong></a></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center>
<?php
echo onlineIndicator('yahoo.com', 80);
?>
</center></TD>



</tr>

</table></center></br>
</td>
</tr>




norėdamas įdėti naują serverį naudok

<TD WIDTH="" HEIGHT="" ALIGN="left" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center<b>YAHOO</center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center><a href=http://yahoo.com target='main'> <strong>yahoo.com</strong></a></center></TD>
<TD WIDTH="" HEIGHT="" ALIGN="" VALIGN="" NOWRAP COLSPAN="" ROWSPAN="" BGCOLOR="" BORDERCOLOR="" BACKGROUND=""><center>
<?php
echo onlineIndicator('yahoo.com', 80);
?>




O šitoje eilutėje įrašai serverio duomenis:
echo onlineIndicator('yahoo.com', 80);




Jei neveiks, sakyk, kokį error išmeta

Redagavo Rytis· 2007 Lap. 29 20:11:59

Parašė Lordcraft· 2007 Lap. 29 20:11:23
#4

aciu ryti ;)