Changeset 40 for www/share/online.php


Ignore:
Timestamp:
Feb 1, 2008, 7:57:51 AM (17 years ago)
Author:
george
Message:

Opraveno: Skripty ve složce share.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/share/online.php

    r1 r40  
    1 <?
    2 include('../db.php');
    3 DB_Init('localhost','root','','share');
    4 echo("\n====================== Kontrolel online pocitacu ============================\n\n");
     1<?php
     2include('../global.php');
     3//$Database->select_db('share');
     4echo("\n====================== Kontrola online pocitacu ============================\n\n");
    55//while(true)
    66{
     
    7070
    7171  // Deaktivuj predchozi online pocitace
    72   DB_Update('hosts', 1, array('online' => 0));
     72  $Database->update('hosts', 1, array('online' => 0));
    7373 
    7474  //print_r($Online);
     
    7676  foreach($Online as $Item)
    7777  {
    78     DB_Query("SELECT * FROM hosts WHERE name='".$Item['host']."'");
    79     if(DB_NumRows()>0)
     78    $DbResult = $Database->query("SELECT * FROM hosts WHERE name='".$Item['host']."'");
     79    if($DbResult->num_rows > 0)
    8080    {
    81       DB_Update('hosts',"name='".$Item['host']."'",array( 'IP' => $Item['IP'], 'MAC' => $Item['MAC'], 'online' => 1, 'lastdate' => 'NOW()', 'section' => $Section));
    82     } else DB_Insert('hosts',array('name' => $Item['host'], 'IP' => $Item['IP'], 'MAC' => $Item['MAC'], 'online' => 1,'date' => 'NOW()','lastdate' => 'NOW()', 'section' => $Section));
     81      $Database->update('hosts',"name='".$Item['host']."'",array( 'IP' => $Item['IP'], 'MAC' => $Item['MAC'], 'online' => 1, 'lastdate' => 'NOW()', 'section' => $Section));
     82    } else $Database->insert('hosts',array('name' => $Item['host'], 'IP' => $Item['IP'], 'MAC' => $Item['MAC'], 'online' => 1,'date' => 'NOW()','lastdate' => 'NOW()', 'section' => $Section));
    8383  }
    8484 
    8585  echo("\nSeznam offline pocitacu:\n");
    86   DB_Query("SELECT * FROM hosts WHERE online=0");
    87   while($Row = DB_Row())
     86  $DbResult = $Database->query("SELECT * FROM hosts WHERE online=0");
     87  while($Row = $DbResult->fetch_array())
    8888  {
    8989    echo($Row['name'].", ");
Note: See TracChangeset for help on using the changeset viewer.