🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #220135

Re: wykonanie polecenia

#220135
From: BaRt
Date: Thu, 27 Aug 2009 01:13
147 lines
5622 bytes
ja się podłącz z swoim skryptem
naskrobałem coś w stylu:

-----------------------------------
ping.php-----------------------------------
<?php
//Moduł do pingowania adresów

$action = $_GET['action'];

//generowanie strony www
if (!$action) {
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta http-equiv="Content-Language" content="pl">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-2">
<title>::: LMS : Opowiedź ping z adresu: <?php echo $_GET['ip']; ?
>  :::</title>
<link href="../img/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript" src="../img/
common.js"> </script>
<script language="JavaScript" type="text/JavaScript" src="../img/
ClickShowHideMenu.js"> </script>
<script type="text/javascript">
<!--
var licz = 0;

  function httpGetObject() {
    this.onrecv = null
    this.onerror = null
    this.get = function(ip) {
      var getScript = document.createElement('script')
      with (getScript) {
        setAttribute('id', 'ping');
        setAttribute('type', 'text/javascript');
        setAttribute('src', 'ping.php?ip=' + ip + '&action=ping');
      }
      document.getElementsByTagName('head').item(0).appendChild
(getScript);
    }
  }

  window.hgObj = new httpGetObject()

  hgObj.onrecv = function(ip) {
    setTimeout(function() {document.getElementsByTagName('head').item
(0).removeChild(document.getElementById("ping"));}, 1);
    licz++;
    if (licz < 10) { setTimeout(function(){hgObj.get(ip);},1000);};
    };


//-->
</script>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
bgcolor="#EBE4D6" link="#800000" vlink="#800000" alink="#336600"
onLoad="hgObj.get('<?php echo $_GET['ip']; ?>');">
<center>
</br></br>



<TABLE WIDTH="400 px" CELLPADDING="3" ID="tabela" ><TBODY>

        <TR CLASS="DARK">
                <TD WIDTH="1%" CLASS="FLEFTU">
                        <IMG SRC="../img/node.gif" BORDER="0">
                </TD>
                <TD WIDTH="98%" CLASS="FRIGHTU" COLSPAN="3">
                        <B>Opowiedź ping z adresu: <?php echo $_GET
['ip']; ?></B>
                </TD>
        </TR>

        <TR CLASS="LIGHT">
                <TD WIDTH="1%" COLSPAN="3" CLASS="FLEFTU" style="text-
align: center;" ID="msm">0/0/0</TD>
                <TD WIDTH="1%" CLASS="FRIGHTU" NOWRAP VALIGN="BOTTOM"
ALIGN="RIGHT" ID="count">0/0</TD>
        </TR>

</TBODY></TABLE>
</center>
</body>
</html>



<?php
    };

// Generowani skryptu dodającego kolejne wiersze do tabeli.

if ($action == "ping") {

    $addres_to_ping = $_GET['ip'];
    $ping = exec("ping " . $addres_to_ping . " -c 1");

    echo "
        if (window.hgObj && hgObj.onrecv) {
        var tableRef = document.getElementById('tabela');
        var newRow   = tableRef.insertRow(1);
        var C  = newRow.insertCell(0);
        C.setAttribute('CLASS', 'FRIGHT');
        var C  = newRow.insertCell(0);
        C.setAttribute('WIDTH', '20%');";
    if ($ping == "") {
        echo "C.innerHTML = '---';
        var C  = newRow.insertCell(0);
        C.setAttribute('WIDTH', '80%');
        C.setAttribute('style', 'color:red;');
        C.innerHTML = ' Brak odpowiedzi ';";
        } else {
        preg_match("/rtt min\/avg\/max\/mdev = (.*)\/(.*)\/(.*)\/(.*)
ms/", $ping, $ping);
        echo "C.innerHTML = '" . $ping[2] . "';
        var C  = newRow.insertCell(0);
        C.setAttribute('WIDTH', '80%');
        C.innerHTML = ' Odpowiedź otrzymano po upływie: ';";
        };
    echo "
        var C  = newRow.insertCell(0);
        C.setAttribute('CLASS', 'FLEFT');
        hgObj.onrecv('" . $addres_to_ping . "');
        }";

    };

?>
-----------------------------------
EOF-----------------------------------

tylko że firefox działa bez problemu a w ie pokazuje cały czas tą samą
odpowiedź
ff: http://img25.imageshack.us/img25/9853/firefoxafc.jpg
ie: http://img40.imageshack.us/img40/7975/88408235.jpg

poz tym jak widać ie nie formatuje komórek ale to mały szczegół
wizualny który nie jest najważniejszy.
proszę o jakieś wskazówki co muszę przerobić lub ewentualnie wskazanie
odpowiedniego forum
jestem oczywiście początkujący wiec proszę o jasne wskazówki i
ewentualne poprawki mało estetycznego kodu
Technical Details
Message-ID: <c174991e-0bc1-48c8-9350-bdd9a75a9aa9@o32g2000yqm.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!postnews.google.com!o32g2000yqm.googlegroups.com!not-for-mail
References: <4a828081$1@news.home.net.pl> <h5u14d$hse$1@atlantis.news.neostrada.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!postnews.google.com!o32g2000yqm.googlegroups.com!not-for-mail
From: BaRt <bartek.gut@gmail.com>
Newsgroups: pl.comp.lang.php
Subject: Re: wykonanie polecenia
Date: Wed, 26 Aug 2009 18:13:15 -0700 (PDT)
Organization: http://groups.google.com
Lines: 150
Message-ID: <c174991e-0bc1-48c8-9350-bdd9a75a9aa9@o32g2000yqm.googlegroups.com>
References: <4a828081$1@news.home.net.pl> <h5u14d$hse$1@atlantis.news.neostrada.pl>
NNTP-Posting-Host: 91.150.162.70
Mime-Version: 1.0
X-Trace: posting.google.com 1251335595 1048 127.0.0.1 (27 Aug 2009 01:13:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 27 Aug 2009 01:13:15 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o32g2000yqm.googlegroups.com; posting-host=91.150.162.70;  posting-account=nxWwPwoAAABPzItNkSMhA1vd-XyDMb_x
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.2)  Gecko/20090729 Firefox/3.5.2,gzip(gfe),gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit