Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    ping domanda sul metodo

    ciao ragazzi, ho un problema:

    con il codice che vi posto vado a pingare un indirizzo ip,

    problema io non voglio che mi ridia tutta la tiritera (la struttura chassica del ping perr intenderci) ma, e in parte è gia risolto, se il ping =0 allora fai qualcosa.

    l'if l'ho fatto e funziona solo che continua a stamparmi tutto il ping con la risposta

    qualcuuno ne sa qualcosa?



    <?php
    $max_count = 10; //maximum count for ping command
    $windows = 1; //set this to 1 if you are on a windows system
    $register_globals = (bool) ini_get('register_gobals');
    $system = ini_get('system');
    $win = (bool) $windows;
    //
    If ($register_globals)
    {
    $ip = getenv(REMOTE_ADDR);
    $self = $PHP_SELF;
    }
    else
    {
    $submit = $_GET['submit'];
    $count = $_GET['count'];
    $host = $_GET['host'];
    $ip = $_SERVER['REMOTE_ADDR'];
    $self = $_SERVER['PHP_SELF'];
    };
    // form submitted ?
    If ($submit == "Ping!")
    {
    // over count ?
    If ($count > $max_count)
    {
    echo 'Maximum for count is: '.$max_count;
    echo 'Back';
    }
    else
    {
    // replace bad chars
    $host= preg_replace ("/[^A-Za-z0-9.]/","",$host);
    echo '<body bgcolor="yellow"></body>';




    echo("Ping Output:
    ");
    echo '';
    //check target IP or domain
    if ($win)

    {
    if (system("ping -n $count $host")==0) {echo"ciao";
    }
    }
    echo '';
    }
    }
    else
    {
    echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
    echo '

    <font size="2">Your IP is: '.$ip.'</font></p>';
    echo '<form methode="post" action="'.$self.'">';
    echo ' Enter IP or Host <input type="text" name="host" value="'.$ip.'"></input>';
    echo ' Enter Count <input type="text" name="count" size="2" value="4"></input>';
    echo ' <input type="submit" name="submit" value="Ping!"></input>';
    echo '</form>';
    echo '
    '.$system.'';
    echo '</body>';
    }
    ?>

  2. #2
    :'( niuno sa niente?

  3. #3
    help


    semplicemente devo fare un if in cui se pinga il client metto undisegno se non lo pinga ne metto un altro

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.