Creating a PHP network panel

Asked

Viewed 578 times

0

I am with the following doubt I have an oracle database with all the names and ip of the users. I would like to use this database in this code instead of using this array?

<!-- painel.php -->
<html>
<head>
  <META HTTP-EQUIV="Refresh" CONTENT="60">
</head>
<body>
  <h3>Painel de Monitoramento de Hosts</h3>
  <table border=1 cellspacing=3>
    <tr>
      <? 
        $servidores= array ("fabio.vivaolinux.com.br"=>"200.215.128.83", "webmail.vivaolinux.com.br" => "200.215.128.241" ); 
        while (list($site,$ip) = each($servidores)) { 
            $comando = "/bin/ping -c 1 " . $ip; 
            $saida = shell_exec($comando); 
            echo "<td>".$site."<br>".$ip."<br>"."Status:"; 
            if ( ereg("bytes from",$saida) ) { 
                echo "<b>online</b></td>"; 
            } else { 
                echo "<font color=red><b>não responde</b></font></td>"; 
            } 
        } 
     ?>
    </tr>
  </table>
</body>
</html>
<!-- fim do programa -->
  • 1

    Yes it is possible to replace this array with a database. Enter which database you have and see if its driver is available in php.

  • How is the structure of your database? Which database is using?

  • In case you will first need to make a connection to the database, then select the data in the desired tables and loop to display the data.

  • 1

    i am using Sql oracle

  • If you can put the table structure is good.

  • @rray I imagine that the structure of the table is similar to the array create table servidores id int(11), site varchar(255), ip varchar(15)), of course, I’m guessing as basic as possible and I don’t even know if it’s right.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.