918-git-images-111dconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 88fc95a was
b6ec162,
checked in by Ramón M. Gómez <ramongomez@…>, 6 years ago
|
#834: Remove all redundant PHP closing tags.
|
-
Property mode set to
100644
|
File size:
2.1 KB
|
Line | |
---|
1 | <?php |
---|
2 | //Ficheros de inclusión. |
---|
3 | include_once (dirname (__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'tftputils.php'); |
---|
4 | |
---|
5 | // ************************************************************************************************ |
---|
6 | // Aplicación WEB: ogAdmWebCon |
---|
7 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
8 | // Fecha Creación: Año 2009-2010 |
---|
9 | // Fecha Última modificación: Agosto-2010 |
---|
10 | // Nombre del fichero: ordenadores_eliminacion.php |
---|
11 | // Descripción : |
---|
12 | // Elimina en cascada registros de la tabla ordenadores |
---|
13 | // Parametros: |
---|
14 | // - cmd:Una comando ya operativo (con conexión abierta) |
---|
15 | // - identificador: El identificador por el que se eliminará el ordenador |
---|
16 | // - nombreid: Nombre del campo identificador del registro |
---|
17 | // - swid: Indica 0= El identificador es tipo alfanumérico 1= EI identificador es tipo numérico ( valor por defecto) |
---|
18 | //************************************************************************************************* |
---|
19 | function EliminaOrdenadores($cmd,$identificador,$nombreid,$swid=1) |
---|
20 | { |
---|
21 | if (empty ($identificador)) return (true); // Salir si identificador nulo. |
---|
22 | if($swid==0) |
---|
23 | $cmd->texto="SELECT idordenador, mac FROM ordenadores WHERE ".$nombreid."='".$identificador."'"; |
---|
24 | else |
---|
25 | $cmd->texto='SELECT idordenador, mac FROM ordenadores WHERE '.$nombreid.'='.$identificador; |
---|
26 | $rs=new Recordset; |
---|
27 | $rs->Comando=&$cmd; |
---|
28 | if (!$rs->Abrir()) return (false); // Error al abrir recordset. |
---|
29 | if ($rs->numeroderegistros==0) return (true); // No hay registros que borrar. |
---|
30 | $rs->Primero(); |
---|
31 | while (!$rs->EOF){ |
---|
32 | $mac = $rs->campos["mac"]; |
---|
33 | $cmd->texto="DELETE FROM ordenadores_particiones WHERE idordenador=".$rs->campos["idordenador"]; |
---|
34 | $resul=$cmd->Ejecutar(); |
---|
35 | if ($resul) { |
---|
36 | // Borrar fichero PXE asociado. |
---|
37 | deleteBootFile ($mac); |
---|
38 | } else { |
---|
39 | $rs->Cerrar(); |
---|
40 | return(false); |
---|
41 | } |
---|
42 | $rs->Siguiente(); |
---|
43 | } |
---|
44 | if ($swid==0) |
---|
45 | $cmd->texto="DELETE FROM ordenadores WHERE ".$nombreid."='".$identificador."'"; |
---|
46 | else |
---|
47 | $cmd->texto='DELETE FROM ordenadores WHERE '.$nombreid.'='.$identificador; |
---|
48 | $resul=$cmd->Ejecutar(); |
---|
49 | return($resul); |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.