0 ) { $img_prop = GetImageSize($imgData); $db_Foto_w = $img_prop[0]; $db_Foto_h = $img_prop[1]; $addsql_p1 = ",Foto_mime='$imgData_type', Foto_w='$db_Foto_w', Foto_h='$db_Foto_h'"; } $sql = "UPDATE estilos SET ". "parent='$db_parent' ". ",titulo='$db_titulo' ". ",descr='".urlencode($db_descr)."' $addsql_p1". " WHERE id=$mod"; $res = @mysql_query( $sql, $conexion ); $last_id = $mod; echo "Algunos datos:
"; if ( !empty($imgData_name) && $imgData_size > 0 ) { $file_size = filesize($imgData); fwrite( fopen("db/estilos/".$last_id."_i001", "wb"), fread(fopen($imgData,"rb"),$file_size), $file_size); } $list = true; } if( isset( $ins ) ) { if ( !empty($imgData_name) && $imgData_size > 0 ) { $img_prop = GetImageSize($imgData); $db_Foto_w = $img_prop[0]; $db_Foto_h = $img_prop[1]; $addsql_p1 = ",Foto_mime, Foto_w, Foto_h"; $addsql_p2 = ",'$imgData_type', '$db_Foto_w', '$db_Foto_h'"; } $sql = "INSERT INTO estilos ($blq1 $addsql_p1) VALUES ('$db_parent','$db_titulo','$db_descr' $addsql_p2)"; $res = @mysql_query( $sql, $conexion ) OR die( "Error
".@mysql_error($conexion) ); $last_id = @mysql_insert_id($conexion); if ( !empty($imgData_name) && $imgData_size > 0 ) { $file_size = filesize($imgData); fwrite( fopen("db/estilos/".$last_id."_i001", "wb"), fread(fopen($imgData,"rb"),$file_size), $file_size); } echo "

Estilo insertado




"; echo "

ID asignado = ".$last_id."

"; $list = true; } if( isset( $del ) ) { if ( !unlink( "estilos/".$del."_i001" ) ) echo "

No he podido eliminar la imagen asociada:


Borre el fichero: estilos/$del"."_i001 manualmente por favor...
"; else echo "

  • Ficheros asociados eliminados
  • "; $res = @mysql_query( "UPDATE estilos SET parent='0' WHERE parent=$del", $conexion ); echo "
  • Estilos heredados, descompuestos
  • "; $res = @mysql_query( "DELETE FROM estilos WHERE id=$del", $conexion ); echo "
  • Estilo $del, ELIMINADO

  • "; $list = true; } if ( isset( $list ) && $list ) { if ( !isset($orderBy) ) $orderBy ="id"; if ( !isset($orderDir) ) $orderDir ="ASC"; echo "Listado de Estilos >> Ver listado

    "; displayList($conexion, $orderBy, $orderDir); } displayMenu(); } function cambiaProporciones() { global $db_Foto_w, $db_Foto_h; $W = 150; $H=150; // Las proporciones correctas seran de 100x100 // $db_Foto_w=50; // $db_Foto_h=50; if ( $db_Foto_w > 0 ) { if ( $db_Foto_w > $db_Foto_h ) { $db_Foto_h = intval(($db_Foto_h/$db_Foto_w)*$W); $db_Foto_w=$W; } else { $db_Foto_w = intval(($db_Foto_w/$db_Foto_h)*$H); $db_Foto_h=$H; } } } function displayList($cnx, $orderBy, $orderDir) { global $db_Foto_w, $db_Foto_h; $thisLOCATION = "./?dgo=adm/estilos.php"; $res = @mysql_query( "SELECT e.id, ep.titulo, e.titulo, e.descr, e.Foto_mime, e.Foto_w, e.Foto_h FROM estilos AS e LEFT JOIN estilos AS ep ON (ep.id=e.parent) ORDER BY e.$orderBy $orderDir", $cnx ) OR die( "Error
    ".@mysql_error($conexion) );; $parity = true; while( $datos=@mysql_fetch_array($res) ) { list ( $db_id, $db_ptitulo, $db_titulo, $db_descr, $db_Foto_mime, $db_Foto_w, $db_Foto_h )= $datos; $parity = !$parity; cambiaProporciones(/* $db_Foto_w, $db_Foto_h*/); $lBlq1 = "
    $db_titulo"; $lBlq2 = "

    >> >Eliminar Estilo ## " .">> >Modificar Estilo

    "; if ( $parity ) echo "
    $lBlq1".urldecode($db_descr)."$lBlq2


    "; else echo "
    ".urldecode($db_descr)."$lBlq2$lBlq1


    "; } echo ''; } function displayMenu() { echo '
    '; echo '

    Insertar nuevo estilo

    '; echo '
    '; } function displayForm( $form_action ) { global $db_parent, $db_titulo, $db_descr, $imgData; echo '
    '; echo '

     

    '; echo '

    Datos del estilo

     

     
    Titulo: Información del estilo

    Aqui van el titulo y descripción del estilo que esta definiendo.
    Tambien puede agregar una imagen que represente este estilo. Recuerde que deberia ser JPG con un tamaño de 50x50 máximo.

    ATENCION: ¡¡ Se admiten controles HTML !!, por lo que aconsejamos sea muy cuidadoso con los mismos.

    Padre:
    Comentarios adicionales:

    Imagen:


    '; } ?>