Autor Zpráva
Pivna
Profil
Zdravím nevite nekdo jak udělat status na web aby sem i zobrazovalo kdyz bude server online tak Online a kdyz bude off tak Offline ? Nevite nekdo jak nato kdyžtak ip serveru 127.0.0.1,2593 kdybyto knecemu prispělo :-D Děkuji za opoved
bohyn
Profil
Pivna
Jake mas moznosti na strane HTTP serveru (scriptovaci jazyky) a co ti bezi na serveru ktery chces testovat? Podle toho se da hledat mozne reseni. Samotne HTML na to zadne nastroje nema.
Pivna
Profil
mno server je delanej v C# jedna se o Runuo pro hru ultima online a potřebuj udostat status na web když se server spuštěn a kdy ne ....
on je tam script na webstatus ale ten negeneruje z toho runka na web data
[code]using System;
using System.IO;
using System.Text;
using Server;
using Server.Network;
using Server.Guilds;

namespace Server.Misc
{
public class StatusPage : Timer
{
public static bool Enabled = false;

public static void Initialize()
{
if ( Enabled )
new StatusPage().Start();
}

public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
{
Priority = TimerPriority.FiveSeconds;
}

private static string Encode( string input )
{
StringBuilder sb = new StringBuilder( input );

sb.Replace( "&", "&" );
sb.Replace( "<", "&lt;" );
sb.Replace( ">", "&gt;" );
sb.Replace( "\"", "&quot;" );
sb.Replace( "'", "&apos;" );

return sb.ToString();
}

protected override void OnTick()
{
if ( !Directory.Exists( "web" ) )
Directory.CreateDirectory( "web" );

using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
{
op.WriteLine( "<html>" );
op.WriteLine( " <head>" );
op.WriteLine( " <title>RunUO Server Status</title>");
op.WriteLine( " </head>" );
op.WriteLine( " <body bgcolor=\"white\">" );
op.WriteLine( " <h1>RunUO Server Status</h1>" );
op.WriteLine( " Online clients:<br>" );
op.WriteLine( " <table width=\"100%\">" );
op.WriteLine( " <tr>" );
op.WriteLine( " <td bgcolor=\"black\"><font color=\"white\">Name</font></td><td bgcolor=\"black\"><font color=\"white\">Location</font></td><td bgcolor=\"black\"><font color=\"white\">Kills</font></td><td bgcolor=\"black\"><font color=\"white\">Karma / Fame</font></td>" );
op.WriteLine( " </tr>" );

foreach ( NetState state in NetState.Instances )
{
Mobile m = state.Mobile;

if ( m != null )
{
Guild g = m.Guild as Guild;

op.Write( " <tr><td>" );

if ( g != null )
{
op.Write( Encode( m.Name ) );
op.Write( " [" );

string title = m.GuildTitle;

if ( title != null )
title = title.Trim();
else
title = "";

if ( title.Length > 0 )
{
op.Write( Encode( title ) );
op.Write( ", " );
}

op.Write( Encode( g.Abbreviation ) );

op.Write( ']' );
}
else
{
op.Write( Encode( m.Name ) );
}

op.Write( "</td><td>" );
op.Write( m.X );
op.Write( ", " );
op.Write( m.Y );
op.Write( ", " );
op.Write( m.Z );
op.Write( " (" );
op.Write( m.Map );
op.Write( ")</td><td>" );
op.Write( m.Kills );
op.Write( "</td><td>" );
op.Write( m.Karma );
op.Write( " / " );
op.Write( m.Fame );
op.WriteLine( "</td></tr>" );
}
}

op.WriteLine( " <tr>" );
op.WriteLine( " </table>" );
op.WriteLine( " </body>" );
op.WriteLine( "</html>" );
}
}
}
}[/code]
bohyn
Profil
Pivna
Script co jsi poslal generuje jakesi info (web/status.html) o stavu RunUO serveru. Zmenou adresare do ktereho se info uklada to muzes dostat na web. Jestli server bezi nebo ne z toho ale nepoznas. Sel by ale urcite napsat script pro RunUO ktery by kazdych, rekneme 10 -15 sekund, ulozil soubor na disk s aktualnim datumem a casem. S tim pak muzes pracovat v nejakem scriptovacim jazyku na webu, nebo stahnou a zpracovat pomoci JavaScriptu na strane uzivatele.

Nevite nekdo jak nato kdyžtak ip serveru 127.0.0.1,2593 kdybyto knecemu prispělo
Prispelo by to jedine kdybych zrovna sedel u PC na kterem bezi to RunUO, totoze takhle mi to vede na muj pocitac :) (127.0.0.1 = localhost = PC na ktereho zrovna pracujes)
Pivna
Profil
nebo sem tam mel jeste todle <html>
<head>
<title>RunUO Server Status</title>
</head>
<body bgcolor="white">
<h1>RunUO Server Status</h1>
Online clients:<br>
<table width="100%">
<tr>
<td bgcolor="black"><font color="white">Name</font></td><td bgcolor="black"><font color="white">Location</font></td><td bgcolor="black"><font color="white">Kills</font></td><td bgcolor="black"><font color="white">Karma / Fame</font></td>
</tr>
<tr>
</table>
</body>
</html>
Pete5
Profil *
Jestli ti stačí jen status online/offline tak tu máš kód

$server_ip = "ip_serveru";
$server_port = port_serveru;
$x = "Jmone serveru";

if(fsockopen($server_ip, $server_port, $errno, $errstr, 30))
{
$x .= "<b style=\"color:green;\">Online</b>.";
}
else
{
$x .= "<b style=\"color:red;\">Offline</b>.";
}

echo $x;
closeside();

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0