0) { fwrite($gestion, $row['kernel'] . " EACregistred=YES " . $varinfoaula . "\n"); $append=str_replace("repo_client", $repo_client, $row['append']); ## echo $append . "\n"; fwrite($gestion, $append . " ip=" . $infohost['ipaddress'] .":" . $repo_client . ":" . $gateway . ":" . $netmask . ":" . $infohost['hostname'] . ":eth0 ro " . " " . $varinfohost . " ". $varinfoparameters . " \n"); } else { fwrite($gestion, $row['kernel'] . " \n"); fwrite($gestion, $row['append'] . " \n"); } $prompt=$row['prompt']; $timeout=$row['timeout']; } fwrite($gestion, " \n"); fwrite($gestion, "PROMPT " . $prompt ." \n"); fwrite($gestion, "TIMEOUT " . $timeout . " \n"); mysql_free_result($rsbootoption); fwrite($gestion, " \n"); fclose($gestion); exec("chown www-data:www-data /tftpboot/pxelinux.cfg/". $macfile); exec("chmod 777 /tftpboot/pxelinux.cfg/". $macfile); #return("ok"); # actualizando el boot del cliente #system(REPO . "admin/procedimientos/Log " . SQL_HOST . " ' 00:00 ' ' " . $ip . " solicita un SetDefaultBoot ' ' " . $boot . " " . $ip . " con resultado " . $bootstatus ."'"); } # no integrado function Logger () { #include("/var/EAC/admin/config/EAC.conf"); # formato de entrada # 1IP ; 2tiempo proceso; 3comando; 4parametros #$hora=date("H:i:s"); #$dia=date("Y-m-d"); #formato del log # IPsolicitante ; dia ; hora ; tiempo proceso ; comando; parametros #formato del log #mensaje en ventana del solicitante. #echo($_SERVER['argv'][1] . " ; " . $dia . " ; " . $hora . " ; " . $_SERVER['argv'][2] . " ; " . $_SERVER['argv'][3] . " ; " . $_SERVER['argv'][4]); #$info=$_SERVER['argv'][1] . " ; " . $dia . " ; " . $hora . " ; " . $_SERVER['argv'][2] . " ; " . $_SERVER['argv'][3] . " ; " . $_SERVER['argv'][4] . "\n"; #echo($info); ## escritura en el ficheor /var/EAC/hosts/$IP-Log #$fp = fopen(REPO . "hosts/" . $_SERVER['argv'][1] ."-Log", "ab"); #fwrite($fp, $info); #fclose($fp); ## insertar la informacion en la base de datos #$conexion=mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die ('no se ha podido conectar con mysql'); #mysql_select_db(DATABASE, $conexion); #$insert="insert into log (ip, dia, hora, tiempo_proceso, comando, parametros) values ('".$_SERVER['argv'][1] . "','" . $dia . "','" .$hora . "','" .$_SERVER['argv'][2]."','".$_SERVER['argv'][3]."','".$_SERVER['argv'][4]."')"; #echo $insert . "\n"; #$resultado = mysql_query($insert) or die (mysql_error()); #mysql_close($conexion); } #primera integracion function InsertClassrom ($descripcion,$subred,$netmask,$broadcast,$gateway,$repo_image,$repo_client) { $query="select * from infonetaulas where descripcion='" . $descripcion ."'"; echo $query; $rs=mysql_query($query); $num_rows = mysql_num_rows($rs); $row = mysql_fetch_assoc($rs); if ($num_rows == 0 ) { $insert="insert into infonetaulas (descripcion, subred, netmask, broadcast, gateway, repo_image, repo_client) values ('$descripcion', '$subred', '$netmask', '$broadcast', '$gateway', '$repo_image', '$repo_client')"; #echo $row['id_aula']; echo $insert; $resultado = mysql_query($insert) or die (mysql_error()); mysql_free_result($rs); $query="select * from infonetaulas where descripcion='" . $descripcion ."'"; #echo $query; $rs=mysql_query($query); $num_rows = mysql_num_rows($rs); $row = mysql_fetch_assoc($rs); if ($num_rows > 0 ) { echo "creando directorios"; $dir = REPOSTATIC . "client/etc/startpage/models"; $dh = opendir($dir); while (false !== ($nombre_archivo = readdir($dh))) { $archivos[] = $nombre_archivo; } foreach ($archivos as $directorio) { if ((strlen($directorio) >= 3) and ($directorio <> '.svn')) { #echo "creando " . $directorio; exec("touch /opt/opengnsys/client/etc/startpage/A_id". $row['id_aula'] ."_". $directorio); } } } } #mysql_close($conexion); } # no integrado function InsertDefaultClassrom ($descripcion,$subred,$netmask,$broadcast,$gateway,$repo_image,$repo_client) { #include ("/var/EAC/admin/config/EAC.conf"); $conexion=mysql_connect(SQL_HOST_LOCAL, SQL_USER, SQL_PASS) or die ('no se ha podido conectar con mysql'); mysql_select_db(DATABASE, $conexion); $query="select * from aulas"; $rs=mysql_query($query); $num_rows = mysql_num_rows($rs); echo $num_rows; if ($num_rows == 0 ) { $insert="insert into aulas (descripcion, subred, netmask, broadcast, gateway, repo_image, repo_client) values ('$descripcion', '$subred', '$netmask', '$broadcast', '$gateway', '$repo_image', '$repo_client')"; } else { $insert="update aulas SET descripcion='" . $descripcion . "', subred='". $subred . "', netmask='" . $netmask ."', broadcast='". $broadcast ."', gateway='" . $gateway . "', repo_image='" . $repo_image ."', repo_client='" . $repo_client ."' WHERE id_aula=1"; } echo $insert; $resultado = mysql_query($insert) or die (mysql_error()); mysql_free_result($rs); $query="select * from aulas where descripcion='" . $descripcion ."'"; echo $query; $rs=mysql_query($query); $num_rows = mysql_num_rows($rs); $row = mysql_fetch_assoc($rs); if ($num_rows > 0 ) { echo $row['id_aula']; echo "creando directorios"; $dir = REPO . "admin/startpage/models"; $dh = opendir($dir); while (false !== ($nombre_archivo = readdir($dh))) { $archivos[] = $nombre_archivo; } foreach ($archivos as $directorio) { if ((strlen($directorio) >= 3) and ($directorio <> '.svn')) { #echo "creando " . $directorio; exec("touch /var/EAC/admin/startpage/A_id". $row['id_aula'] ."_". $directorio); } } } mysql_free_result($rs); mysql_close($conexion); } # no integrado function InsertItemtoMenu ($menu,$item) { #include ("/var/EAC/admin/config/EAC.conf"); #echo $menu . $item . "\n"; # $conexion=mysql_connect(SQL_HOST_LOCAL, SQL_USER, SQL_PASS) or die ('no se ha podido conectar con mysql'); # mysql_select_db(DATABASE, $conexion); $query="select * from menuboot_itemboot where labelmenu='$menu' and labelitem='$item'"; echo " " . $query . " \n"; $rs=mysql_query($query); $num_rows = mysql_num_rows($rs); echo $num_rows; if ($num_rows < 1 ) { $insert="insert into menuboot_itemboot values ('$menu', '$item', 0)"; echo " ".$insert . " \n"; $resultado = mysql_query($insert) or die (mysql_error()); mysql_free_result($rs); mysql_close($conexion); } } ?>