[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-ocs/sources/www/ -> install.php (source)

   1  <?
   2  //====================================================================================
   3  // OCS INVENTORY REPORTS
   4  // Copyleft Pierre LEMMET 2005
   5  // Web: http://ocsinventory.sourceforge.net
   6  //
   7  // This code is open source and may be copied and modified as long as the source
   8  // code is always made freely available.
   9  // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
  10  //====================================================================================
  11  //Modified on 07/05/2005
  12  
  13  set_time_limit(0); 
  14  error_reporting(E_ALL & ~E_NOTICE);
  15  ?>
  16  <html>
  17  <head>
  18  <TITLE>OCS Inventory Installation</TITLE>
  19  <LINK REL='StyleSheet' TYPE='text/css' HREF='css/ocsreports.css'>
  20  </head><body>
  21  
  22  <?
  23  printEnTeteInstall("OCS Inventory Installation");
  24  
  25  if( isset($fromAuto) && $fromAuto==true)
  26  echo "<center><br><font color='green'><b>Current installed version ".$valUpd["tvalue"]." is lower than this version (".GUI_VER.") automatic install launched</b></red><br></center>";
  27  
  28  /*
  29  if(!isset($_POST["name"])) {
  30      if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
  31          fclose($hnd);
  32          include("dbconfig.inc.php");
  33          $_POST["name"] = $_SESSION["COMPTE_BASE"];
  34          $_POST["pass"] = $_SESSION["PSWD_BASE"];
  35          $_POST["host"] = $_SESSION["SERVEUR_SQL"];
  36      }
  37      else {
  38          $_POST["name"] = "root";
  39          $_POST["pass"] = "";
  40          $_POST["host"] = "localhost";
  41      }
  42      $firstAttempt=true;
  43  }*/ 
  44  
  45  if(!function_exists('session_start')) {    
  46      echo "<br><center><font color=red><b>ERROR: Sessions for PHP is not properly installed.<br>Try installing the php4-session package.</b></font></center>";
  47      die();
  48  }
  49  
  50  if(!function_exists('xml_parser_create')) {    
  51      echo "<br><center><font color=orange><b>WARNING: XML for PHP is not properly installed, you will not be able to use ipdiscover-util.</b></font></center>";
  52  }
  53  
  54  if(!function_exists('mysql_connect')) {    
  55      echo "<br><center><font color=red><b>ERROR: MySql for PHP is not properly installed.<br>Try installing mysql for php package (Debian: php4-mysql)</b></font></center>";
  56      die();
  57  }
  58  
  59  if(!function_exists('imagefontwidth')) {    
  60      echo "<br><center><font color=orange><b>WARNING: GD for PHP is not properly installed.<br>You will not be able to see any graphical display<br>Try uncommenting \";extension=php_gd2.dll\" (windows) by removing the semicolon in file php.ini, or try installing the php4-gd package (Linux).</b></font></center>";
  61  }
  62  
  63  if(!function_exists('openssl_open')) {    
  64      echo "<br><center><font color=orange><b>WARNING: OpenSSL for PHP is not properly installed.<br>Some automatic deployment features won't be available<br>Try uncommenting \";extension=php_openssl.dll\" (windows) by removing the semicolon in file php.ini, or try installing the php4-openssl package (Linux).</b></font></center>";
  65  }
  66  
  67  @mkdir($_SERVER["DOCUMENT_ROOT"]."/download");
  68  $pms = "post_max_size";
  69  $umf = "upload_max_filesize";
  70  
  71  $valTpms = ini_get( $pms );
  72  $valTumf = ini_get( $umf );
  73  
  74  $valBpms = return_bytes( $valTpms );
  75  $valBumf = return_bytes( $valTumf );
  76  
  77  if( $valBumf>$valBpms )
  78      $MaxAvail = $valTpms;
  79  else
  80      $MaxAvail = $valTumf;
  81  
  82  echo "<br><center><font color=orange><b>WARNING: You will not be able to build any auto deployment package with size 
  83  greater than $MaxAvail.<br>You must raise both post_max_size and upload_max_filesize in your php.ini to correct this.</b></font></center>";
  84  
  85  include  ('fichierConf.class.php');
  86  
  87  $l = new FichierConf("english"); // on cr�e l'instance pour avoir les mots dans la langue choisie
  88  if( isset($_POST["name"])) {
  89          if( (!$link=@mysql_connect($_POST["host"],$_POST["name"],$_POST["pass"]))) {
  90          $firstAttempt=false;
  91          echo "<br><center><font color=red><b>ERROR: ".$l->g(249)." (host=".$_POST["host"]." name=".$_POST["name"]." pass=".$_POST["pass"].")<br>
  92              Mysql error: ".mysql_error()."</b></font></center>";
  93      }
  94      else
  95          $instOk = true;
  96  }
  97  if( ! $instOk ) {
  98  
  99      if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
 100              fclose($hnd);
 101              include("dbconfig.inc.php");
 102              $valNme = $_SESSION["COMPTE_BASE"];
 103              $valPass = $_SESSION["PSWD_BASE"];
 104              $valServ = $_SESSION["SERVEUR_SQL"];
 105      }
 106  
 107      echo "<br><form name='fsub' action='install.php' method='POST'><table width='100%'>
 108      <tr>
 109          <td align='right' width='50%'>
 110              <font face='Verdana' size='-1'>".$l->g(247)." :&nbsp;&nbsp;&nbsp;&nbsp;</font>
 111          </td>
 112          <td width='50%' align='left'><input size=40 name='name' value='$valNme'>
 113          </td>
 114      </tr>
 115      <tr>
 116          <td align='right' width='50%'>
 117              <font face='Verdana' size='-1'>".$l->g(248)." :&nbsp;&nbsp;&nbsp;&nbsp;</font>
 118          </td>
 119          <td width='50%' align='left'><input size=40 type='password' name='pass' value='$valPass'>
 120          </td>
 121      </tr>
 122      <tr>
 123          <td align='right' width='50%'>
 124              <font face='Verdana' size='-1'>".$l->g(250)." :&nbsp;&nbsp;&nbsp;&nbsp;</font>
 125          </td>
 126          <td width='50%' align='left'><input size=40 name='host' value='$valServ'>
 127          </td>
 128      </tr>
 129      <tr><td>&nbsp;</td></tr>
 130          <tr>
 131          <td colspan='2' align='center'>
 132              <input class='bouton' name='enre' type='submit' value=".$l->g(13)."> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 133          </td>
 134      </tr>
 135      
 136      </table></form>";
 137      die();
 138  }
 139  
 140  
 141  if($firstAttempt==true && $_POST["pass"] == "") {
 142      echo "<br><center><font color=orange><b>WARNING: your the default root password is set on your mysql server. Change it asap. (using root password=blank)</b></font></center>";
 143  }
 144  
 145  if(!mysql_query("set global max_allowed_packet=2097152;")) {
 146      echo "<br><center><font color=orange><b>WARNING: The user you typed does not seem to be root<br>If you encounter any problem with files insertion, try setting the global max_allowed_packet mysql value to at least 2M in your server config file.</font></center>";
 147  }
 148  
 149  mysql_select_db("ocsweb"); 
 150  
 151  if(isset($_POST["label"])) {
 152      
 153      if($_POST["label"]!="") {
 154          @mysql_query( "DELETE FROM deploy WHERE NAME='label'");
 155          $query = "INSERT INTO deploy VALUES('label','".$_POST["label"]."');";
 156          mysql_query($query) or die(mysql_error());
 157          echo "<br><center><font color=green><b>Label added</b></font></center>";
 158      }
 159      else {
 160          echo "<br><center><font color=green><b>Label NOT added (not tag will be asked on client launch)</b></font></center>";
 161      }
 162  }
 163  
 164  if($_POST["fin"]=="fin") {
 165      if(!@mysql_connect($_POST["host"],"ocs","ocs")) {
 166          if(mysql_errno()==0) {
 167              echo "<br><center><font color=red><b>ERROR: MySql authentication problem. You must add the 'old-passwords' in your mysql configuration file (my.ini). Then restart mysql, and relaunch install.php</b><br></font></center>";
 168              die();
 169          }
 170          else
 171              echo "<br><center><font color=red><b>ERROR: MySql authentication problem. (using host=".$_POST["host"]." login=ocs pass=ocs).</b><br></font></center>";
 172          
 173          echo "<br><center><font color=red><b>ERROR: The installer ended unsuccessfully, rerun install.php once problems are corrected</b></font></center>";
 174          unlink("dbconfig.inc.php");
 175      }
 176      else {
 177          echo "<br><center><font color=green><b>Installation finished you can log in index.php with login=admin and pass=admin</b><br><br><b><a href='index.php'>Click here to enter OCS-NG GUI</a></b></font></center>";
 178      }    
 179      die();
 180  }
 181  
 182  
 183  if(!$ch = @fopen("dbconfig.inc.php","w")) {
 184      echo "<br><center><font color=red><b>ERROR: can't write in directory (on dbconfig.inc.php), please set the required rights in order to install ocsinventory (you should remove the write mode after the installation is successfull)</b></font></center>";
 185      die();
 186  }
 187  
 188  fwrite($ch,"<?\n\$_SESSION[\"SERVEUR_SQL\"]=\"".$_POST["host"]."\";\n\$_SESSION[\"COMPTE_BASE\"]=\"ocs\";\n\$_SESSION[\"PSWD_BASE\"]=\"ocs\";\n?>");
 189  fclose($ch);
 190  
 191  echo "<br><center><font color=green><b>MySql config file successfully written</b></font></center>";
 192  
 193  $db_file = "ocsbase.sql";
 194  if($dbf_handle = @fopen($db_file, "r")) {
 195      echo "<br><center><font color=black><b>Please wait, database update may take up to 30 minutes...";
 196      flush();
 197      $sql_query = fread($dbf_handle, filesize($db_file));
 198      fclose($dbf_handle);
 199      $dejaLance=0;
 200      $li = 0;
 201      foreach ( explode(";", "$sql_query") as $sql_line) {
 202          $li++;
 203          if(!mysql_query($sql_line)) {
 204              if(  mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1044 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061) 
 205                  continue;        
 206  
 207              if(  mysql_errno()==1071 ) {
 208                  echo "<br><center><font color=red><b>ERROR: line $li: query:[$sql_line] failed, KEY was too long<br>You need to redo this query later or you will experience severe performance issues.</b><br>";
 209                  continue;
 210              }
 211              
 212              if(mysql_errno()==1007 || mysql_errno()==1050) {
 213                  $dejaLance = 1;
 214                  continue;
 215              }
 216              
 217              echo "<br><center><font color=red><b>ERROR: line $li: query:[$sql_line] failed</b><br>";
 218              echo "<b>mysql error: ".mysql_error()." (err:".mysql_errno().")</b></font></center>";
 219              $nberr++;
 220          }
 221          echo ".";
 222          flush();
 223      }
 224      echo "</b></font></center>";
 225      if(!$nberr&&!$dejaLance)
 226          echo "<br><center><font color=green><b>Database successfully generated</b></font></center>";
 227  }
 228  else {
 229      echo "<br><center><font color=red><b>ERROR: $db_file needed</b></font></center>";
 230      die();
 231  }
 232  
 233  if($dejaLance>0)    
 234      echo "<br><center><font color=green><b>Existing database updated</b></font></center>";
 235      
 236  echo "<br><center><font color=black><b>Database engine checking...";
 237  flush();
 238  $tableEngines = array("hardware"=>"InnoDB","accesslog"=>"InnoDB","bios"=>"InnoDB","memories"=>"InnoDB","slots"=>"InnoDB",
 239  "registry"=>"InnoDB","monitors"=>"InnoDB","ports"=>"InnoDB","storages"=>"InnoDB","drives"=>"InnoDB","inputs"=>"InnoDB",
 240  "modems"=>"InnoDB","networks"=>"InnoDB","printers"=>"InnoDB","sounds"=>"InnoDB","videos"=>"InnoDB","softwares"=>"InnoDB",
 241  "accountinfo"=>"InnoDB","netmap"=>"InnoDB","devices"=>"InnoDB", "locks"=>"HEAP");
 242  
 243  $nbconv = 0;
 244  $erralter = false;
 245  foreach( $tableEngines as $tbl=>$eng ) {
 246      if( $res = mysql_query("show table status like '$tbl'") ) {
 247          $val = mysql_fetch_array( $res );
 248          if( $val["Engine"] == $eng ) {
 249              echo ".";
 250              flush();
 251          }
 252          else {
 253              $nbconv++;
 254              echo ".";
 255              flush();
 256              if( ! $resAlter = mysql_query("ALTER TABLE $tbl engine='$eng'") ) {
 257                  $nberr++;
 258                  $erralter = true;
 259                  echo "</b></font></center><br><center><font color=red><b>ERROR: Alter query failed</b><br>";
 260                  echo "<b>mysql error: ".mysql_error()." (err:".mysql_errno().")</b></font></center>";
 261              }
 262          }
 263      }
 264      else {
 265          echo "</b></font></center><br><center><font color=red><b>ERROR: Show table status query failed</b><br>";
 266          echo "<b>mysql error: ".mysql_error()." (err:".mysql_errno().")</b></font></center>";
 267          $nberr++;
 268          $erralter = true;
 269      }
 270  }
 271  $oneFailed = false;
 272  foreach( $tableEngines as $tbl=>$eng ) {
 273      if( $res = mysql_query("show table status like '$tbl'") ) {
 274          $val = mysql_fetch_array( $res );
 275          if( (strcasecmp($val["Engine"],$eng) != 0) && (strcasecmp($eng,"InnoDB") == 0) && $oneFailed == false ) {
 276              echo "<br><br><center><font color=red><b>ERROR: InnoDB conversion failed, install InnoDB  mysql engine support on your server<br>or you will experience severe performance issues.<br>
 277              (Try to uncomment \"#skip-innodb\" in your mysql config file.)<br>Reinstall when corrected.</b></font><br>";
 278              $oneFailed = true;
 279          }
 280          if ( (strcasecmp($val["Engine"],$eng)!=0) && (strcasecmp($eng,"HEAP")) && (strcasecmp($val["Engine"],"MEMORY")!=0)  ) {
 281              echo "<br><br><center><font color=red><b>ERROR: HEAP conversion failed, install HEAP mysql engine support on your server<br>or you will experience severe performance issues.</b></font><br>";
 282          }
 283      }
 284      else {
 285          echo "</b></font></center><br><center><font color=red><b>ERROR: Show table status query failed</b><br>";
 286          echo "<b>mysql error: ".mysql_error()." (err:".mysql_errno().")</b></font></center>";
 287          $nberr++;
 288          $erralter = true;
 289      }
 290  }
 291  
 292  if( ! $erralter ) {
 293      echo "</b></font></center><br><center><font color=green><b>Database engine successfully updated ($nbconv table(s) altered)</b></font></center>";
 294  }
 295      
 296  if($nberr) {
 297      echo "<br><center><font color=red><b>ERROR: The installer ended unsuccessfully, rerun install.php once problems are corrected</b></font></center>";
 298      unlink("dbconfig.inc.php");
 299      die();
 300  }
 301  $nberr=0;
 302  $dir = "files";
 303  $filenames = Array("ocsagent.exe");
 304  $dejaLance=0;
 305  $filMin = "";
 306  
 307  mysql_query("DELETE FROM deploy");
 308  mysql_select_db("ocsweb"); 
 309  foreach($filenames as $fil) {
 310      $filMin = $fil;
 311      if ( $ledir = @opendir("files")) {
 312          while($filename = readdir($ledir)) {
 313              if(strcasecmp($filename,$fil)==0 && strcmp($filename,$fil)!=0  ) {
 314                  //echo "<br><center><font color=green><b>$fil case is '$filename'</b></font></center>";
 315                  $fil = $filename;
 316              }
 317          }
 318          closedir($ledir);
 319      }
 320      else {
 321          echo "<br><center><font color=orange><b>WARNING: 'files' directory missing, can't import $fil from it</b></font></center>";
 322      }
 323      
 324      if($fd = @fopen($dir."/".$fil, "r")) {
 325          $contents = fread($fd, filesize ($dir."/".$fil));
 326          fclose($fd);    
 327          $binary = addslashes($contents);    
 328          $query = "INSERT INTO deploy VALUES('$filMin','$binary');";
 329          
 330          if(!mysql_query($query)) {            
 331              if(mysql_errno()==1007 || mysql_errno()==1050 || mysql_errno()==1062) {
 332                      $dejaLance++;
 333                      continue;
 334              }
 335              if(mysql_errno()==2006) {
 336                  echo "<br><center><font color=red><b>ERROR: $fil was not inserted. You need to set the max_allowed_packet mysql value to at least 2M</b></font></center>";
 337                  echo "<br><center><font color=red><b>ERROR: The installer ended unsuccessfully, rerun install.php once problems are corrected</b></font></center>";
 338                  unlink("dbconfig.inc.php");
 339                  die();
 340              } 
 341              echo "<br><center><font color=red><b>ERROR: $fil not inserted</b><br>";
 342              echo "<b>mysql error: ".mysql_error()."</b></font></center>";        
 343              $nberr++;
 344          }
 345      }
 346      else {
 347          echo "<br><center><font color=orange><b>WARNING: ".$dir."/".$fil." missing, if you do not reinstall the DEPLOY feature won't be available</b></font></center>";
 348          $errNorm = true;
 349      }
 350  }
 351  
 352  if($dejaLance>0)    
 353      echo "<br><center><font color=orange><b>WARNING: One or more files were already inserted</b></font></center>";
 354  
 355  if(!$nberr&&!$dejaLance&&!$errNorm)
 356      echo "<br><center><font color=green><b>Deploy files successfully inserted</b></font></center>";
 357  
 358  mysql_query("DELETE FROM files");
 359  $nbDeleted = mysql_affected_rows();
 360  if( $nbDeleted > 0)
 361      echo "<br><center><font color=green><b>Table 'files' truncated</b></font></center>";
 362  else
 363      echo "<br><center><font color=green><b>Table 'files' was empty</b></font></center>";
 364  
 365  if($nberr) {
 366      echo "<br><center><font color=red><b>ERROR: The installer ended unsuccessfully, rerun install.php once problems are corrected</b></font></center>";
 367      unlink("dbconfig.inc.php");
 368      die();
 369  }
 370  
 371  $row = 1;
 372  $handle = @fopen("subnet.csv", "r");
 373  
 374  if( ! $handle ) {
 375      echo "<br><center><font color=green><b>No subnet.csv file to import</b></font></center>";
 376  }
 377  else {
 378      $errSub = 0;
 379      $resSub = 0;
 380      $dejSub = 0;
 381      echo "<hr><br><center><font color=green><b>Inserting subnet.csv networks</b></font></center>";
 382      while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
 383      
 384          $ipValide = "(([0-9]{1,3}\.){3}[0-9]{1,3})";
 385          $masqueEntier = "([0-9]{1,3})";
 386          $masqueValide = "(($ipValide|$masqueEntier)[ ]*$)";
 387          $exp = $ipValide."[ ]*/[ ]*".$masqueValide;
 388  
 389          if( preg_match("/$exp/",$data[2],$res) ) {
 390              
 391              if( @mysql_query("INSERT INTO subnet(netid, name, id, mask) 
 392              VALUES ('".$res[1]."','".$data[0]."','".$data[1]."','".$res[4]."')") ) {
 393                  $resSub++;
 394                  //echo "<br><center><font color=green><b>
 395                  //Network => name: ".$data[0]." ip: ".$res[1]." mask: ".$res[4]." id: ".$data[1]." successfully inserted</b></font></center>";
 396              }
 397              else {
 398                  if( mysql_errno() != 1062) {
 399                      $errSub++;
 400                      echo "<br><center><font color=red><b>ERROR: Could not insert network ".$data[0]." in the subnet table, error ".mysql_errno().": ".mysql_error()."</b></font></center>";
 401                  }
 402                  else
 403                      $dejSub++;
 404              }
 405          }
 406          else {
 407              $errSub++;
 408              echo "<br><center><font color=orange><b>WARNING: Network ".$data[0]." was not inserted (invalid ip or mask: ".$data[2].")</b></font></center>";
 409          }
 410      }
 411      fclose($handle);
 412      echo "<br><center><font color=green><b>Subnet was imported=> $resSub successful, <font color=orange>$dejSub were already imported</font>, <font color=red>$errSub failed</font></b></font></center><hr>";
 413      
 414  }
 415  
 416  
 417  echo "<br><center><font color=green><b>Network netid computing. Please wait...</b></font></center>";
 418  flush();
 419  
 420  $reqDej = "SELECT COUNT(id) as nbid FROM networks WHERE ipsubnet IS NOT NULL";
 421  $resDej = mysql_query($reqDej) or die(mysql_error());
 422  $valDej = mysql_fetch_array($resDej);
 423  $errNet = 0;
 424  $sucNet = 0;
 425  $dejNet = $valDej["nbid"];
 426  
 427  $reqNet = "SELECT hardware_id, id, ipaddress, ipmask FROM networks WHERE ipsubnet='' OR ipsubnet IS NULL";
 428  $resNet = mysql_query($reqNet) or die(mysql_error());
 429  while ($valNet = mysql_fetch_array($resNet) ) {
 430      $netid = getNetFromIpMask( $valNet["ipaddress"], $valNet["ipmask"] );
 431      if( !$netid || $valNet["ipaddress"]=="" || $valNet["ipmask"]=="" ) {
 432          $errNet++;
 433      }
 434      else {
 435          mysql_query("UPDATE networks SET ipsubnet='$netid' WHERE hardware_id='".$valNet["hardware_id"]."' AND id='".$valNet["id"]."'");
 436          if( mysql_errno() != "") {
 437              $errNet++;
 438              echo "<br><center><font color=red><b>ERROR: Could not update netid to $netid, error ".mysql_errno().": ".mysql_error()."</b></font></center>";
 439          }
 440          else {
 441              $sucNet++;
 442          }
 443      }    
 444  }
 445  echo "<br><center><font color=green><b>Network netid was computed=> $sucNet successful, <font color=orange>$dejNet were already computed</font>, <font color=red>$errNet were not computable</font></b></font></center>";
 446  
 447  echo "<br><center><font color=green><b>Netmap netid computing. Please wait...</b></font></center>";
 448  flush();
 449  
 450  $reqDej = "SELECT COUNT(mac) as nbid FROM netmap WHERE netid IS NOT NULL";
 451  $resDej = mysql_query($reqDej) or die(mysql_error());
 452  $valDej = mysql_fetch_array($resDej);
 453  $errNet = 0;
 454  $sucNet = 0;
 455  $dejNet = $valDej["nbid"];
 456  
 457  $reqNet = "SELECT mac, ip, mask FROM netmap WHERE netid='' OR netid IS NULL";
 458  $resNet = mysql_query($reqNet) or die(mysql_error());
 459  while ($valNet = mysql_fetch_array($resNet) ) {
 460      $netid = getNetFromIpMask( $valNet["ip"], $valNet["mask"] );
 461      if( !$netid || $valNet["ip"]=="" || $valNet["mask"]=="" ) {
 462          $errNet++;
 463      }
 464      else {
 465          mysql_query("UPDATE netmap SET netid='$netid' WHERE mac='".$valNet["mac"]."' AND ip='".$valNet["ip"]."'");
 466          if( mysql_errno() != "") {
 467              $errNet++;
 468              echo "<br><center><font color=red><b>ERROR: Could not update netid to $netid, error ".mysql_errno().": ".mysql_error()."</b></font></center>";
 469          }
 470          else {
 471              $sucNet++;
 472          }
 473      }    
 474  }
 475  echo "<br><center><font color=green><b>Netmap netid was computed=> $sucNet successful, <font color=orange>$dejNet were already computed</font>, <font color=red>$errNet were not computable</font></b></font></center>";
 476  
 477  
 478  function printEnTeteInstall($ent) {
 479      echo "<br><table border=1 class= \"Fenetre\" WIDTH = '62%' ALIGN = 'Center' CELLPADDING='5'>
 480      <th height=40px class=\"Fenetre\" colspan=2><b>".$ent."</b></th></table>";
 481  }
 482  
 483  ?><br>
 484  <center>
 485  <form name='taginput' action='install.php' method='post'><b>
 486  <font color='black'>Please enter the label of the windows client tag input box:<br>
 487  (Leave empty if you don't want a popup to be shown on each agent launch).</font></b><br><br>
 488      <input name='label' size='40'>
 489      <input type='hidden' name='fin' value='fin'>
 490      <input type='hidden' name='name' value='<?=$_POST["name"];?>'>
 491      <input type='hidden' name='pass' value='<?=$_POST["pass"];?>'>
 492      <input type='hidden' name='host' value='<?=$_POST["host"];?>'>
 493      <input type=submit>
 494      
 495  </form></center>
 496  <?
 497  
 498  function getNetFromIpMask($ip, $mask) {    
 499      return ( long2ip(ip2long($ip)&ip2long($mask)) ); 
 500  }
 501  
 502  function return_bytes($val) {
 503      $val = trim($val);
 504      $last = strtolower($val{strlen($val)-1});
 505      switch($last) {
 506          // Le modifieur 'G' est disponible depuis PHP 5.1.0
 507          case 'g':
 508              $val *= 1024;
 509          case 'm':
 510              $val *= 1024;
 511          case 'k':
 512              $val *= 1024;
 513      }
 514  
 515      return $val;
 516  }
 517  
 518  ?>
 519  
 520  
 521  
 522  
 523  
 524  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1