- Timestamp:
- Feb 1, 2008, 7:57:51 AM (17 years ago)
- Location:
- www/share
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
www/share/browse.php
r4 r40 1 1 <?php 2 2 include('../style.php'); 3 include('../global.php');4 3 $Database->select_db('share'); 5 4 $ZanoreniMax = 8; // Maximální úroven zanoreni … … 8 7 $MountDir = '/tmp/browse/host'; // Složka, kde se dočasně připojují síťové disky 9 8 $TempDir = '/tmp/browse/'; // Složka, kde se dočasně připojují síťové disky 10 if(!is_dir($TempDir)) mkdir($TempDir, 0777);11 if(!is_dir($MountDir)) mkdir($MountDir, 0777);9 if(!is_dir($TempDir)) mkdir($TempDir, 0777); 10 if(!is_dir($MountDir)) mkdir($MountDir, 0777); 12 11 13 12 // Nacteni seznamu sdileni … … 42 41 function Vetev($Cesta,$Zanoreni) 43 42 { 44 global $Citac, $Soubor,$Host,$HostID,$Share,$ZanoreniMax,$Pocet,$Hotovo,$MountDir,$TempDir,$FileSize,$MaxProgress, $Database;43 global $Citac, $Soubor, $Host, $HostID, $Share, $ZanoreniMax, $Pocet, $Hotovo, $MountDir, $TempDir, $FileSize, $MaxProgress, $Database; 45 44 46 45 $VelikostSlozky = 0; … … 60 59 //echo(strlen($Nazev).","); 61 60 array_push($Files,$Nazev); 62 } while(($Nazev !="\n")&&(!feof($Soubor)));61 } while(($Nazev != "\n") && (!feof($Soubor))); 63 62 array_pop($Files); 64 63 //if(($Pocet-floor($Pocet/10)*10)==9) 65 $Hotovo = floor(ftell($Soubor) /$FileSize*$MaxProgress);66 if($Hotovo >=$Pocet)64 $Hotovo = floor(ftell($Soubor) / $FileSize * $MaxProgress); 65 if($Hotovo >= $Pocet) 67 66 { 68 echo(str_repeat('#', $Hotovo-$Pocet));67 echo(str_repeat('#', $Hotovo-$Pocet)); 69 68 $Pocet = $Hotovo; 70 69 } … … 75 74 $Radek = substr($Radek,0,-1); 76 75 //echo($Radek.",\n"); 77 if($Radek[0] =='d') $Type = 2; else $Type = 0;76 if($Radek[0] == 'd') $Type = 2; else $Type = 0; 78 77 $Prava = substr($Radek,0,strpos($Radek,' ')); 79 78 $Radek = ltrim(substr($Radek,strlen($Prava)+1)); … … 93 92 //echo($Date.','.$Time.','.$Radek.' '); 94 93 95 if((strpos($Nazev,'.') >0)&&($Type!=2))94 if((strpos($Nazev,'.') > 0) && ($Type != 2)) 96 95 { 97 96 $Ext = substr($Nazev,strrpos($Nazev,'.')+1); … … 127 126 //DB_Query("SELECT SUM(size) FROM items WHERE (parent=".$Parent.")"); 128 127 //$Row = DB_Row(); 129 $Database->update('items', 'id='.$Parent,array('size' => $VelikostSlozky));128 $Database->update('items', 'id='.$Parent, array('size' => $VelikostSlozky)); 130 129 //closedir($Dir); 131 130 return($VelikostSlozky); … … 133 132 134 133 // Proskenuj jednotlive sdileni 135 $Database-> uery('DELETE FROM items WHERE host='.$HostID); // Smaz predchozi polozky134 $Database->query('DELETE FROM items WHERE host='.$HostID); // Smaz predchozi polozky 136 135 137 136 // Zapis nazev pocitace … … 168 167 { 169 168 // Přidej poloľku sdílení do datanáze 170 DB_Insert('items',array(169 $Database->insert('items',array( 171 170 'name' => $Share, 172 171 'size' => 0, … … 200 199 // Zaktivuj strom 201 200 echo("Provadim aktivaci nove naskenovaneho stromu..."); 202 $Database->select ('is');201 $Database->select_db('is'); 203 202 $DbResult = $Database->query("SELECT id FROM hosts WHERE name='".$Host."'"); 204 203 $Row = $DbResult->fetch_array(); 205 204 $NewID = $Row['id']; 206 $Database->selec et_db('share');205 $Database->select_db('share'); 207 206 $Database->query("DELETE FROM items WHERE host=".$NewID); 208 207 $Database->update('items','host='.$HostID,array('host' => $NewID)); … … 242 241 { 243 242 $Row = substr($ShareFull.'/'.substr($Row, 39), 0, -1); 244 DB_Insert('errors', array('host' => $Host, 'message' => $Row));243 $Database->insert('errors', array('host' => $Host, 'message' => $Row)); 245 244 echo($Row."\n"); 246 245 } … … 252 251 } 253 252 254 echo("Doba procházení: ".date("H:i:s", time()-$StartTime-3600)."\n\n");253 echo("Doba procházení: ".date("H:i:s", time() - $StartTime - 3600)."\n\n"); 255 254 ?> -
www/share/online.php
r1 r40 1 <? 2 include('../ db.php');3 DB_Init('localhost','root','','share');4 echo("\n====================== Kontrol elonline pocitacu ============================\n\n");1 <?php 2 include('../global.php'); 3 //$Database->select_db('share'); 4 echo("\n====================== Kontrola online pocitacu ============================\n\n"); 5 5 //while(true) 6 6 { … … 70 70 71 71 // Deaktivuj predchozi online pocitace 72 DB_Update('hosts', 1, array('online' => 0));72 $Database->update('hosts', 1, array('online' => 0)); 73 73 74 74 //print_r($Online); … … 76 76 foreach($Online as $Item) 77 77 { 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) 80 80 { 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)); 83 83 } 84 84 85 85 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()) 88 88 { 89 89 echo($Row['name'].", "); -
www/share/update.php
r1 r40 1 <? 1 <?php 2 2 include('../style.php'); 3 include('../db.php');4 DB_Init('localhost','root','','is');5 3 6 //$Perioda = 3600*3; // proch ázet po tøech hodinách4 //$Perioda = 3600*3; // prochazet po tech hodinach 7 5 8 6 $Dnes = date('Y-m-d'); … … 11 9 $Hosts = array(); 12 10 $StartTime = GetMicrotime(); 13 DB_Query("SELECT * FROM hosts WHERE online=1 AND (block=0 OR name='centrala') AND (name!='GATE') AND user>0");14 while($Row = DB_Row())11 $DbResult = $Database->query("SELECT * FROM hosts WHERE online=1 AND (block=0 OR name='centrala') AND (name!='GATE') AND user>0"); 12 while($Row = $DbResult->fetch_array()) 15 13 { 16 14 //echo('Host: '.$Host."...\n"); … … 24 22 passthru('env browse_host='.$Row['name'].' browse_id='.$HostID.' php -q -c php.ini -f browse.php'); 25 23 } 26 else echo("Vynechávám ".$Row['name']."...\n"); 27 // Aktualizuj datum procházení 28 DB_Save(); 29 DB_Update('hosts',"name='".$Row['name']."'",array('last_share_check' => $Dnes)); 30 DB_Load(); 24 else echo("Vynechavam ".$Row['name']."...\n"); 25 // Aktualizuj datum prochazeni 26 $Database->update('hosts',"name='".$Row['name']."'",array('last_share_check' => $Dnes)); 31 27 } 32 28 $Rozdil = GetMicrotime()-$StartTime+10; 33 29 34 // Oprav a zoptima izuj tabulku35 DB_Init('localhost', 'root', '','share');30 // Oprav a zoptimalizuj tabulku 31 $Database->select_db('share'); 36 32 echo('Opravuji tabulku...'); 37 DB_Query('REPAIR TABLE items');33 $Database->query('REPAIR TABLE items'); 38 34 echo("\nOptimalizuji tabulku..."); 39 DB_Query('OPTIMIZE TABLE items');35 $Database->query('OPTIMIZE TABLE items'); 40 36 41 echo("\nDoba prochá zení:".date("H:i:s",$Rozdil-3600)."\n\n");37 echo("\nDoba procháení ".date("H:i:s",$Rozdil-3600)."\n\n"); 42 38 //$Cekat = $Perioda-$Rozdil; 43 39 //echo("Cekam ".date("H:i:s",$Cekat-3600)." minut...\n");
Note:
See TracChangeset
for help on using the changeset viewer.