Forum gesperrt  Dieses Thema ist gesperrt. Du kannst keine Beiträge editieren oder weitere Antworten erstellen.  [ 6 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: homepage plug in ?
BeitragVerfasst: 09.04.2002, 07:32 

Registriert: 18.01.2002, 17:37
Beiträge: 25
HAllo
weis nun nicht ob ichhier richtig bin, aber ich suche ein plug in wo ich auf der hompage per ssi oder so anzeigen lassen kann wie viele zogger auf dem server gerade zoggen !!!! halt so wie es bei foren oder homepage besuchern zu machen ist !!!

ich hoffe ihr habt verstanden was ich meine, wenn nein
dann schaut mal hier rein http://bc-clan.2xt.de und dann oben rechts dort
habe ich sowas für den chat und das forum und für die anzahl der besucher die gerade auf der page serven !!!!

wäre super wenn wer wüsste wo ich sowas für die anzahl der zogger auf dem server bekommen könnte!!!!!!


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 09.04.2002, 11:29 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Versuch's doch mal mit Psychoquery ( http://www.psychostats.com ). Du brauchst aber Perlzugriff auf Deinem Webserver. Sonst gibt es auch Lösungen für PHP. Such doch mal in http://www.sourceforge.net . Da gibt es einige.
Außerdem gehört das ins Offtopic-Forum. Kann das mal einer dahin verschieben?

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
 Betreff des Beitrags: hmmm
BeitragVerfasst: 09.04.2002, 14:28 

Registriert: 18.01.2002, 17:37
Beiträge: 25
ja perl habe ich abder das was du da meinst ist doch wieder ne rangliste !!! ich kenne dieses ding. ich suche aber nur ein teil was mir auf der startpage meiner homepage anzeigt wie viele gerade zoggen

zb so 12 Leute zoggen gerade!!!

das sollte schon reichen !!!!!!! stats und sowas habe ich ja alles schon !!!
mir fehlt nur nen ding auf der startpage!!!!!!!!


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 09.04.2002, 15:58 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Nein, nein!
Ich spreche nicht von Psychostats! Stormtrooper hat nicht nur das geschrieben. Psychoquery ist genau das, was Du suchst.

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
 Betreff des Beitrags: hallo
BeitragVerfasst: 09.04.2002, 16:33 

Registriert: 18.01.2002, 17:37
Beiträge: 25
also das sieht schon ganz gut aus !
nur leider alles in englisch .

könnte mir wer sagen wo ich da was einstellen muss ?
also hier mal die pquery.pl

-------------------------------------------------------------
#!/usr/bin/perl -w
#
# PsychoQuery script for Half-Life servers.
# Date Started : 12/28/00
# First Release Date : 01/26/01
# Author : Jason Morriss (-Pk-Stormtrooper)
# Email : stormtrooper@psychostats.com
# Website : http://www.psychostats.com/
#
# COPYRIGHT:
# I release this script as freeware. Use it freely as long as you do not
# repackage or re-release it to the public, and under no cercumstances are
# you to sell it. I will not be held responsible for any damages caused by
# this script.
#
# NOTES:
# No other external applications (like QStat) are required for this script.
# See the help page "pquery.pl -help" for more information on how to use this.
#


### Modify these variables if you want #---------------------------------------------

my $maxwait = 10; # number of seconds to wait until we timeout on query.
my $maxretries = 3; # number of times to retry if timed out.
my $retrywait = 3; # number of seconds to wait to retry if we timed out.

### Time/Date settings ...
my $dateformat = 'MM/DD/YYYY'; # MUST use either "YYYY" or "YY" for the year (4 or 2 digits).
# MM and DD can be switched around if desired. MUST BE CAPITALS!
my $timeformat = 'hh:mm:ss'; # MUST use either "hh" or "HH" for hour. "HH" will output in 24 hour format
# "hh" will outout in 12 hour and will append "am" or "pm" to the end.

### Language strings ...
my $l_unknown = "unknown";
my $l_required = "required";
my $l_optional = "optional";
my $l_none = "none";
my $l_dedicated = "dedicated";
my $l_listen = "listen";
my $l_linux = "Linux";
my $l_windows = "Windows";
my $l_private = "private";
my $l_open = "open";


### Do not modify anything else below this line #------------------------------------

my $version = '1.0';
my $timedout = 0; # did we timeout?
my %conf;

use strict;
use Getopt::Long;
use IO::Socket;
use IO::Select;
use Sys::Hostname;

my $socket;
my %info;
my $cgi;

# verify parameters...
&displayhelp() unless GetOptions(
"destfile|o=s" => \$conf{destfile},
"help|h" => \$conf{help},
"local|l" => \$conf{localonly}, # not used anymore!
"port|p=s" => \$conf{port},
"query|q=s" => \$conf{query},
"quiet" => \$conf{quiet},
"rconcmd=s" => \$conf{rconcmd},
"rconpass=s" => \$conf{rconpass},
"server|s=s" => \$conf{server},
"srcfile|f=s" => \$conf{srcfile},
"version|v" => \$conf{version},
);

if (defined $conf{help}) {
&displayhelp();
exit 1;
} elsif (defined $conf{version}) {
print "PsyhoQuery Version $version\n";
exit 1;
}

$conf{query} ||= 'DPR'; # defaults
$conf{port} ||= 27015;

$conf{localonly} = not defined $ENV{REQUEST_METHOD}; # if its not defined then we're NOT running as CGI.

if ($conf{localonly}) {
$conf{server} ||= hostname() . ':' . $conf{port};
$conf{destfile} ||= "-";
$conf{srcfile} ||= &getfilename($0);
} else {
use CGI;
$CGI::POST_MAX = 1024 * 100;
$cgi = new CGI;
$conf{server} = $cgi->param('server') || $cgi->param('s') || hostname() . ':' . $conf{port};
$conf{srcfile} = $cgi->param('srcfile') || $cgi->param('f') || &getfilename($0);
$conf{port} = $cgi->param('port') || $cgi->param('p') || $conf{port};
$conf{rconcmd} = $cgi->param('rconcmd') || undef;
$conf{rconpass} = $cgi->param('rconpass') || undef;
$conf{query} = $cgi->param('query') || $cgi->param('q') || $conf{query};
$conf{destfile} = "-"; # CGI mode will only allow output to STDOUT
print "Content-Type: text/html\n\n";

## beginning '/' root slash or ".." anywhere within the path is not allowed.
if ( (($conf{srcfile} =~ /^\//i) or ($conf{srcfile} =~ /\.\./i)) and ($conf{srcfile} ne &getfilename($0)) ) {
&exitdie("Source directory is invalid! - $conf{srcfile}\n");
}

}

if ($conf{server} =~ /^([^:]+):(\d+)/) {
$conf{server} = $1;
$conf{port} = $2;
}

$socket = &connectsocket($conf{server}, $conf{port}); # this will die if it fails.


if (defined $conf{rconcmd}) {
print &rcon($socket, $conf{rconcmd}, $conf{rconpass}) . "\n";
exit;
}


my $retry = 0;
my $done = 0;
do {
$timedout = 0;
$done = &querydetails($socket,\%info) if (not $timedout) && &query('D');
$done = &queryplayers($socket,\%info) if (not $timedout) && &query('P');
$done = &queryrules($socket,\%info) if (not $timedout) && &query('R');
$done = &queryinfo($socket,\%info) if (not $timedout) && &query('I');
$retry++;
sleep $retrywait if $timedout;
} while ($timedout and $retry <= $maxretries and not $done);

print "Server ($conf{server}:$conf{port}) timed out after $maxretries tries!\n" if $timedout and not $conf{quiet};

$info{updatetime} = time();
$info{version} = $version;

###------------------------------------------------------------------------------------
my $srcfile = $conf{srcfile};
my $destfile = $conf{destfile};
my (@names, @rules, @grp1, @grp2, $grp, $ab, $line, $embedvar);

&exitdie("Error loading file: \"$srcfile\"\n") unless open(SOURCE, "<$srcfile");
my @htmlfile = <SOURCE>;
close(SOURCE);
&exitdie("Error creating file: \"$destfile\"\n") unless open(DEST, ">$destfile");

###------------------------------------------------------------------------------------
$conf{vars}{enablehtml} = 1;
for (my $curline = 0; $curline <= $#htmlfile; $curline++) {
$_ = $htmlfile[$curline];
while (s/<!--\s*(\w+)\s*=\s*(.+?)\s*-->//g) {
$conf{vars}{lc $1} = lc $2;
$embedvar++;
} # embedded variables
next if $embedvar and /^\s*$/; $embedvar = 0;

if (/<!--players\{-->/) {
&getloopsection(\@htmlfile,\$curline,\@grp1,\@grp2);

$conf{vars}{playersort} = 'kills' unless(exists $conf{vars}{playersort});
if ($conf{vars}{playersort} eq 'kills') {
@names = sort { $info{players}{$b}{kills} <=> $info{players}{$a}{kills} } keys %{$info{players}};
} elsif ($conf{'vars'}{'playersort'} eq "time") {
@names = sort { $info{players}{$b}{time} <=> $info{players}{$a}{time} } keys %{$info{players}};
} elsif ($conf{'vars'}{'playersort'} eq "idx") {
@names = sort { $info{players}{$a}{idx} <=> $info{players}{$b}{idx} } keys %{$info{players}};
} elsif ($conf{'vars'}{'playersort'} eq "name") {
@names = sort keys %{$info{players}};
} else {
@names = sort { $info{players}{$a}{kills} <=> $info{players}{$b}{kills} } keys %{$info{players}};
}

$ab = 0;
$info{curidx} = 0;
foreach my $name (@names) {
$info{curidx}++;
$info{var_curplayer} = $name;
$info{var_curidx} = $info{players}{$name}{idx};
$info{var_curkills} = $info{players}{$name}{kills};
$info{var_curtime} = $info{players}{$name}{time};

$grp = ($ab) ? \@grp2 : \@grp1;
$ab = !$ab;
foreach my $thisline (@$grp) {
$line = &parsehtml($thisline, \%info);
print DEST $line;
}
}

} elsif (/<!--rules\{-->/) {
&getloopsection(\@htmlfile,\$curline,\@grp1,\@grp2);

@rules = sort keys %{$info{rules}};
my @ary = ();

$conf{vars}{ruleset} = 'default' unless(exists $conf{vars}{ruleset});
if ($conf{vars}{ruleset} =~ /\/(.+?)\//) {
my $match = '^' . $1;
@ary = (@ary, grep { /$match/i } @rules);
$conf{vars}{ruleset} =~ s/\/.+?\///;
}
@ary = grep { /^(sv_cheats|sv_gravity|sv_maxspeed|sv_aim|sv_contact|
mp_autokick|mp_autoteambalance|mp_c4timer|mp_flashlight|mp_footsteps|
mp_forcechasecam|mp_freezetime|mp_friendlyfire|mp_limitteams|mp_roundtime|
mp_timelimit|mp_tkpunish)
/xi } @rules if $conf{vars}{ruleset} =~ /default/;
@ary = (@ary, grep { /^sv/i } @rules) if $conf{vars}{ruleset} =~ /sv/;
@ary = (@ary, grep { /^mp/i } @rules) if $conf{vars}{ruleset} =~ /mp/;
@ary = (@ary, grep { /^admin/i } @rules) if $conf{vars}{ruleset} =~ /admin/;
@ary = @rules if $conf{vars}{ruleset} =~ /all/;
@rules = @ary;

$ab = 0;
$info{curidx} = 0;
foreach my $rule (@rules) {
$info{curidx}++;
$info{var_currule} = $rule;

$grp = ($ab) ? \@grp2 : \@grp1;
$ab = !$ab;
foreach my $thisline (@$grp) {
$line = &parsehtml($thisline, \%info);
print DEST $line;
}
}

} else {
$line = &parsehtml($_, \%info);
print DEST $line;
} # if/else

} # for each line of SOURCE

close(DEST);
# --------------------------------------------------------------
#
sub query {
my $q = shift;
return (index(lc $conf{query},lc $q) > -1);
}
# --------------------------------------------------------------
#
sub parsehtml {
my ($line, $info) = @_;
my $match = $line;
my ($m, $html);

while ($match =~ m/\$(\w+)/g) {
$m = lc($1);

if ($m eq "modlink") {
my $link = ($info->{modurl} =~ /^[^:]+?:\/\//) ? $info->{modurl} : 'http://' . $info->{modurl};
$html = '<a href="' . $link . '">' . $info->{gamedesc} . '</a>';
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "modname") {
$html = $info->{gamedesc} || $l_unknown;
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "modver") {
$html = $info->{modver} || $l_unknown;
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "modurl") {
$html = $info->{modurl} || $l_unknown;
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "servercontact") {
my @contact = &checkpb($info->{rules}{sv_contact} || '');
$contact[0] =~ s/^\s+//;
$contact[0] =~ s/\s+$//;
$line =~ s/(?i)\$\Q$m/$contact[0] || $l_unknown/e;

} elsif ($m eq "serveraccess") {
if (defined $info->{serverlocked}) {
$html = ($info->{serverlocked}) ? $l_private : $l_open;
} else {
$html = $l_unknown;
}
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m =~ /^cur(time|date)$/) {
if ($1 eq 'time') {
$html = &epochdate($info->{updatetime}, $timeformat);
} else {
$html = &epochdate($info->{updatetime}, $dateformat);
}
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "idx") {
$line =~ s/(?i)\$\Q$m/$info->{curidx}/e;

} elsif ($m eq "serverip") {
$line =~ s/(?i)\$\Q$m/$conf{server}/e;

} elsif ($m eq "serverport") {
$line =~ s/(?i)\$\Q$m/$conf{port}/e;

} elsif ($m =~ /^plridx$/) {
$line =~ s/(?i)\$\Q$m/$info->{var_curidx} || '0'/e;

} elsif ($m eq "plrname") {
if ($conf{var}{enablehtml}) {
$html = &safename($info->{var_curplayer}) || $l_unknown;
} else {
$html = $info->{var_curplayer} || $l_unknown;
}
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "plrkills") {
$line =~ s/(?i)\$\Q$m/$info->{var_curkills} || '0'/e;

} elsif ($m eq "plrtime") {
$html = &compacttime($info->{var_curtime}) || '00:00:00';
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "playercurmax") {
$html = ($info->{curplayers} || '0') . '/' . ($info->{maxplayers} || '0');
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m =~ /^(max|cur|active)players$/) {
$html = $info->{$1.'players'} || '0';
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "totalrules") {
$line =~ s/(?i)\$\Q$m/(defined $info->{numrules}) ? $info->{numrules} : $l_unknown/e;

} elsif ($m eq "rule") {
$line =~ s/(?i)\$\Q$m/$info->{var_currule} || $l_unknown/e;

} elsif ($m eq "rulevalue") {
my $var = (defined $info->{rules}{ $info->{var_currule} }) ? $info->{rules}{ $info->{var_currule} } : $l_unknown;
if ($conf{var}{enablehtml}) {
$html = &safename($var);
} else {
$html = $var;
}
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "pbip") {
$html = (defined $info->{rules}{sv_contact}) ? $l_none : $l_unknown;
my @ip = &checkpb($info->{rules}{sv_contact} || '');
$html = $ip[2] if $ip[2];
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "pbstatus") {
$html = (defined $info->{rules}{sv_contact}) ? $l_none : $l_unknown;
my @status = &checkpb($info->{rules}{sv_contact} || '');
if ($status[1]) {
$html = ($status[1] =~ /req/i) ? $l_required : $l_optional;
}
$line =~ s/(?i)\$\Q$m/$html/e;

} elsif ($m eq "mapname") {
$line =~ s/(?i)\$\Q$m/$info->{map} || $l_unknown/e;

} else {
if (exists $info->{$m}) {
$line =~ s/(?i)\$\Q$m/$info->{$m}/e;
} else {
$line =~ s/(?i)\$\Q$m/$l_unknown/e;
}
}

} # while each match

return $line;
}
# --------------------------------------------------------------
#
sub epochdate {
my ($sec,$min,$hour,$day,$mon,$year) = localtime(shift);
my $format = shift;
my $ampm = '';
$mon++;
$year += 1900;
my $year2k = ($year =~ /(..)$/)[0] || $year;
foreach my $val ($sec,$min,$hour,$day,$mon) { $val = '0'.$val if length($val) < 2; }
if ($format =~ /hh/) {
my $tmptime = &getrealtime("$hour:00:00");
$hour = substr($tmptime, 0, 2);
$ampm = substr($tmptime, 8, 2);
}
$format =~ s/ss/$sec/e;
$format =~ s/mm/$min/e;
$format =~ s/hh/$hour/ei;
$format =~ s/MM/$mon/e;
$format =~ s/DD/$day/e;
$format =~ s/YYYY/$year/e;
$format =~ s/YY/$year2k/e;
return $format . $ampm;
}
# -----------------------------------------------------------------
#
sub getrealtime {
my ($thetime) = @_;
my ($h,$m,$s) = split(/:/,$thetime);
my $ampm = "am";
if ($thetime ne 'unknown') {
if ($h == 12) { $ampm = "pm"; }
elsif ($h > 12) { $h = $h - 12; $ampm = "pm"; }
elsif ($h == 0) { $h = 12; }
$h = "0$h" if (length($h) < 2);
return "$h:$m:$s" . $ampm;
} else {
return $thetime;
}
}
# --------------------------------------------------------------
#
sub checkpb {
my ($str) = @_;
if ($str =~ /^([^{]+){([^}]+)}{([^}]+)}/) {
return ($1,$2,$3);
} else {
return ($str || '','','');
}
}
# --------------------------------------------------------------
#
sub getloopsection {
my ($file, $curline, $grp1, $grp2) = @_;
my $max = $#$file;
@$grp1 = ();
@$grp2 = ();
for ($$curline++ ; $$curline <= $max ; $$curline++) {
$_ = @$file[$$curline];
last if (/<!--\}(\{)*-->/);
push(@$grp1, $_);
}
if (/<!--\}\{-->/) {
for ($$curline++ ; $$curline <= $max ; $$curline++) {
$_ = @$file[$$curline];
last if (/<!--\}-->/);
push(@$grp2, $_);
}
}
if (!@$grp2) { @$grp2 = @$grp1 };
}
# ----------------------------------------------------------
#
sub rcon {
my ($sock, $cmd, $pass) = @_;
my $result = '';
&sendcommand($sock, "challenge rcon\n");
$result = &getresult($sock);
if ($result =~ /^....challenge rcon (\d+)/) {
my $num = $1;
&sendcommand($sock, "rcon $num \"" . ($pass || '') . "\" $cmd");
$result = &getresult($sock);
return $result if ($result =~ s/^....l//);
}
}
# ----------------------------------------------------------
# This is the same as 'querydetails', except the 'info' request
# doesn't return as much information about the server.
sub queryinfo {
my ($socket, $info) = @_;
my $result = '';
&sendcommand($socket, 'info') || &exitdie("Error writing to socket. $!\n");
$result = &getresult($socket);
if ($result =~ s/^....C//) {
$info->{ip} = &getnullstr(\$result);
$info->{name} = &getnullstr(\$result);
$info->{map} = &getnullstr(\$result);
$info->{gamedir} = &getnullstr(\$result);
$info->{gamedesc} = &getnullstr(\$result);
$info->{curplayers} = &getbyte(\$result);
$info->{maxplayers} = &getbyte(\$result);
$info->{protocolver} = &getbyte(\$result);
$result = 1;
} else { $timedout = 1 }
return $result;
}
# ----------------------------------------------------------
#
sub querydetails {
my ($socket, $info) = @_;
my $result = '';
&sendcommand($socket, 'details') || &exitdie("Error writing to socket. $!\n");
$result = &getresult($socket);
if ($result =~ s/^....m//s) {
$info->{ip} = &getnullstr(\$result);
$info->{name} = &getnullstr(\$result);
$info->{map} = &getnullstr(\$result);
$info->{gamedir} = &getnullstr(\$result);
$info->{gamedesc} = &getnullstr(\$result);
$info->{curplayers} = &getbyte(\$result);
$info->{maxplayers} = &getbyte(\$result);
$info->{protocolver} = &getbyte(\$result);
$info->{servertype} = (&getchar(\$result) eq 'd') ? $l_dedicated : $l_listen;
$info->{serveros} = (&getchar(\$result) eq 'l') ? $l_linux : $l_windows;
$info->{serverlocked} = &getbyte(\$result);
$info->{modrunning} = &getbyte(\$result);
$info->{modurl} = ($info->{'modrunning'}) ? &getnullstr(\$result) : '';
$info->{modftp} = ($info->{'modrunning'}) ? &getnullstr(\$result) : '';
$info->{modver} = ( (&getbyte(\$result)) | (&getbyte(\$result) << 8) ) . '.' .
( (&getbyte(\$result)) | (&getbyte(\$result) << 8) );

my ($i1,$i2,$i3,$i4) = (&getbyte(\$result), &getbyte(\$result), &getbyte(\$result), &getbyte(\$result));
$info->{modsize} = (($i1) |
(($i2) << 8) |
(($i3) << 16) |
(($i4) << 24)); # . ' ' . sprintf "(%X %X %X %X)", $i1, $i2, $i3, $i4;
$info->{modserveronly} = &getbyte(\$result);
$info->{modclientdll} = &getbyte(\$result);
$result = 1;
} else { $timedout = 1 }
return $result;
}
# ----------------------------------------------------------
#
sub queryrules {
my ($socket, $info) = @_;
my $result = '';
&sendcommand($socket, 'rules') || &exitdie("Error writing to socket. $!\n");
$result = &getresult($socket);
if ($result =~ s/^....E//s) {
$info->{numrules} = (&getbyte(\$result) | (&getbyte(\$result) << 8)) - 1;
my $rules = join("\n",split(/\x00/,$result)); # split it, or rules wont be read correctly.
for (my $i=1; $i <= $info->{numrules}; $i++) {
if ($rules =~ s/^(.+?)\n(.*)\n//) {
$info->{rules}{$1} = $2;
}
}
$result = 1;
} else { $timedout = 1 }
return $result;
}
# ----------------------------------------------------------
#
sub queryplayers {
my ($socket, $info) = @_;
my $result = '';
my ($idx, $name);
&sendcommand($socket, 'players') || &exitdie("Error writing to socket. $!\n");
$result = &getresult($socket);
if ($result =~ s/^....D//s) {
$info->{activeplayers} = &getbyte(\$result);
for (my $i=1; $i <= $info->{activeplayers}; $i++) {
$idx = &getbyte(\$result);
$name = &getnullstr(\$result);
$info->{players}{$name}{name} = $name;
$info->{players}{$name}{idx} = $idx;
my ($i1,$i2,$i3,$i4) = (&getbyte(\$result), &getbyte(\$result), &getbyte(\$result), &getbyte(\$result));
$info->{players}{$name}{kills} = sprintf "%d", (($i1) | (($i2) << 8) | (($i3) << 16) | (($i4) << 24));
$info->{players}{$name}{time} = int unpack("f", $result); # number of seconds
$result = substr $result, 4;
}
$result = 1;
} else { $timedout = 1 }
return $result;
}
# ----------------------------------------------------------
#
sub queryping {
my ($socket) = @_;
&sendcommand($socket, 'ping') || &exitdie("Error writing to socket. $!\n");
my $result = &getresult($socket);
return ($result =~ /^....j/);
}
# ----------------------------------------------------------
sub sendcommand {
my ($sock, $cmd, $notnull) = @_;
my $sel = new IO::Select($sock);
if ($sel->can_write($maxwait)) {
$sock->send(pack("l",-1) . $cmd . (($notnull) ? '' : pack("x")) );
} else { $timedout = 1; }
return 1;
}
# ----------------------------------------------------------
#
sub getresult {
my ($sock) = @_;
my $sel = new IO::Select($sock);
my $buff = '';
if ($sel->can_read($maxwait)) {
$sock->recv($buff, 10240);
} else { $timedout = 1; }
return $buff;
}
# ----------------------------------------------------------
#
sub connectsocket {
my ($server, $port) = @_;
return IO::Socket::INET->new(Proto=>'udp', PeerAddr=>$server, PeerPort=>$port);
}
# ----------------------------------------------------------
#
sub getchar {
my ($str) = @_;
my $byte = &getbyte($str);
return sprintf("%c", $byte);
}
# ----------------------------------------------------------
#
sub getbyte {
my $str = shift; # $str by reference ($$str)
my $val = 0;
$val = ord($1) if ($$str =~ s/^(.)//s);
return $val;
}
# ----------------------------------------------------------
#
sub getnullstr {
my ($str) = @_; # $str by reference ($$str)
if ($$str =~ s/^(.+?)\x00//s) { # read upto the null byte at the end.
return $1;
} else {
$$str =~ s/^.//s;
}
return '';
}
# -----------------------------------------------------------------
#
sub compacttime {
my ($seconds) = @_;
my ($h,$m,$s) = ('00','00','00');
my $old = $seconds;
my $str = 'hh:mm:ss';

return '00:00:00' if not defined $seconds;
if ( ($seconds / (60*60)) >= 1) { $h = sprintf("%d", $seconds / (60*60)); $seconds -= $h * (60*60)}
if ( ($seconds / 60) >= 1) { $m = sprintf("%d", $seconds / 60); $seconds -= $m * (60)}
if ( ($seconds % 60) >= 1) { $s = sprintf("%d", $seconds % 60);}
$str =~ s/hh/sprintf "%02d",$h/e;
$str =~ s/mm/sprintf "%02d",$m/e;
$str =~ s/ss/sprintf "%02d",$s/e;
return $str;
}
# --------------------------------------------------------------
#
sub getfilename {
my ($path) = @_;
return (($0 =~ /(.+)\.(cgi|pl)$/i)[0] || $path) . ".html";
}
# --------------------------------------------------------------
#
sub safename {
my ($name) = @_;
return "" if not defined $name;
return "" if $name eq "";
$name =~ s/&(?!\w+;)/&/g; # this ignores special HTML tags like & &nbsp; etc...
$name =~ s/\G&(?!\w+;)/&/g;
$name =~ s/</</g;
$name =~ s/>/>/g;
$name =~ s/ /&nbsp;&nbsp;/g;
return $name;
}
# ----------------------------------------------------------
#
sub exitdie {
my ($err) = @_;
print "$err";
exit 0;
}
# ----------------------------------------------------------
#
sub displayhelp {
print "PsychoQuery Version $version\n";
while (<DATA>) { print; }
}
# ----------------------------------------------------------

#23456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-
__DATA__

PsychoQuery Command Line Options:
All command line options have long names which can be abbriviated as much
as possible and some commands have alternate option strings to be compatiable
with the older version of PsychoQuery.

Not all options are available when calling this program as a CGI application.
Each option shown below will note with the words "CGI" if its a valid CGI
option.

-destfile, -o <STRING>
Specifies the filename to write the output to. Defaults to
STDOUT, which means the screen or console you're looking at.

-help, -h
Displays this help screen.

-local, -l
DEPRECIATED. Option no longer used. But remains as a valid option so
PsychoQuery will not give an error when given this option. PsychoQuery
will automatically detect if its being called locally or from a CGI
request and will act accordingly (by outputting the 'Content-Type'
string).

-port, -p <NUMBER> (CGI)
Specifies the default port to use when making a server query. The
port can also be specified in colon ":" notation with the -server
option, which will override any port given with this option.

-query, -q <STRING> (CGI)
Specifies the type of queries to do on the server. The string given
is a series of 1 to 3 letters. Each letter represents a query type.
The default query type is "DPR". See below for the query definations.

"D" (details) : returns basic info on the server running. Such as the
name, ip, number of players, mod information, etc.
"I" (info) : this is the same as 'details' except it has LESS
information. I suggest not using this outdated option
and use 'details' instead. You should never use this
query type at the same time as "D".
"P" (players) : returns basic info on all active clients in the game.
Including their name, frag count and total time.
"R" (rules) : returns all the rule settings on the server.

-quiet
Supresses a couple of errors from being reported if the server
being queried doesn't respond. This is useful so other 3rd
party tools don't get confused due to a PQ error (like MRTG).

-rconcmd <STRING> (CGI)
Specifies an RCON command to send to the server. If an RCON command
is specified the normal output of pquery will be ignored and only
the output from the rcon command will be displayed. You must use
the "rconpass" command below together with this one.

-rconpass <STRING> (CGI)
Specifies the password to use for RCON commands.

-server, -s <IP or HOSTNAME[:PORT]> (CGI)
Server to query. Defaults to the local machine hostname.
Port defaults to 27015 or whatever is specified on the
"-port" option.

-srcfile, -f <STRING> (CGI)
Source filename to use to generate the output report. Defaults
to <scriptfilename (no ext)>.html, ie: "pquery.html".

-version, -v
Displays current version for PsychoQuery and exits.


EXAMPLES:

pquery.pl -destfile /usr/www/html/rtstats.html
This example is run from the command line and thus will be run as
'local' mode. It uses the default "query" of "DPR" for server and
player info. And uses the default source file of 'pquery.html'. Then
outputs the report to the file 'rtstats.html' in the specified path.

pquery.cgi?server=10.1.150.2:27115&srcfile=custom.html
This example queries the server specified by "server". It uses the
'custom.html' file as the template and outputs to STDOUT (meaning
the browser). Also, the name of the script was renamed to '.cgi' so
this will work from a web server w/o any problems (not all servers
are configured to run ".pl" files as CGI apps.


meine server ip lautet 62.4.67.113 port 27060 könnte mir wer die sachen eintragen ????


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 09.04.2002, 18:02 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
1. Stormtrooper hat sich endlich mal die Mühe gemacht und hat eine Doku geschrieben. Lies die! http://www.psychostats.com/pqdocs/
2. Jetzt schau doch mal am Ende vom Perl-Code nach was da steht. Richtig Erklärungen und Beispiele.
3. Es ist eine README.txt im Zipfile beigelegt. In der Regel lohnt es sich da einen Blick reinzuwerfen.
4. Daten ändert man nur da, wo es explizit erlaubt ist. Ergo, unter ### Modify these variables if you want. Und die sind dokumentiert im Quelltext.

Ich glaube, Du hast mehr als genug Hilfe. Solltest Du Probleme haben, wie man bestimmte Rcon-Befehle an den Server schickt, kannst Du Dich nochmal melden. Das ist nicht so trivial.

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Forum gesperrt  Dieses Thema ist gesperrt. Du kannst keine Beiträge editieren oder weitere Antworten erstellen.  [ 6 Beiträge ] 


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Powered by phpBB® Forum Software © phpBB Limited
Deutsche Übersetzung durch phpBB.de
Original Design von "[ Half-Life Admin Mod © Alfred Reynolds 2000-2003 ] - [ site design by Jägermeister ]"