Преглед на файлове

Error. Se toma el sys_groupid como el sys_userid para todo.

master
David Ramos преди 8 години
родител
ревизия
e959a24266
променени са 3 файла, в които са добавени 151 реда и са изтрити 67 реда
  1. +70
    -41
      crear_pdf_o6h.php
  2. +79
    -26
      new_service_webdns.php
  3. +2
    -0
      pdf_o6h.php

+ 70
- 41
crear_pdf_o6h.php Целия файл

@@ -11,12 +11,12 @@ protected $U = 0;
protected $HREF = '';

// Margins
var $left = 10;
var $right = 10;
var $left = 2;
var $right = 2;
var $top = 10;
var $bottom = 10;

//Autor Aramis
function WriteHTML($html)
{
// Intérprete de HTML
@@ -96,6 +96,8 @@ function PutLink($URL, $txt)
$this->SetStyle('U',false);
$this->SetTextColor(0);
}

//Script - Shadow Cell Gledston Reis
function ShadowCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $color='G', $distance=0.5)
{
if($color=='G')
@@ -270,6 +272,7 @@ function ShadowCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false,
}
return $nl;
}
}


@@ -281,6 +284,8 @@ $pass_bd = $_POST['pass_bd2'];
$nombreDominio = $_POST['dominio_nuevo'];
$usuario_ftp = $_POST['usuario_ftp2'];
$pass_ftp = $_POST['pass_ftp2'];
$la_ip4 = $_POST['ip4'];


//$nombre_base = $_POST['nombre_bd'];
//$info=$_GET['datos_pdf'];
@@ -294,101 +299,125 @@ $enlacePriv = '<br><a href="http://www.open6hosting.com/empresa/legales">'.$acen
$enlaceAdvertencia = '<br><a href="http://www.open6hosting.com/lopd.html">Advertencia legal</a>';
$enlaceMail = '<br><a href="info@open6hosting.com">info@open6hosting.com</a>';


$hoy = date("d-m-Y H:i:s");


//print 'en creacion: ' . $nombre_bd . ' ' . $usuario_bd . ' ' . $pass_bd;
//print 'en creacion: ' . $nombre_bd . ' ' . $usuario_bd . ' ' . $pass_bd . ' Aqui la ip: ' . $la_ip4;
$pdf = new PDFO6H();
// Primera página
$pdf->AddPage();
//Uso un ttf con caracteres españoles
//$pdf->AddFont('ArialNarrow','','arial-narrow.php');
$pdf->SetFont('Arial','',28);
//$pdf->Write(5,'Para saber qué hay de nuevo en este tutorial, pulse ');
$pdf->SetFont('','U');
//$link = $pdf->AddLink();
//$pdf->Write(5,'aquí­',$link);
//$pdf->SetFont('','U');
$pdf->SetFont('');
$pdf->SetTextColor(0, 200, 100);
$Text = sprintf($_POST['dominio_nuevo'], 0.5);
$pdf->ShadowCell(0, 80, $Text, 1, 1, 'C', false, '', 'B', 0.5);
$pdf->SetTextColor(0, 0, 0);
//$pdf->ShadowCell(0, 50, $Text , 1, 1, 'C', false, '', 'B', 0.5);
$pdf->SetTextColor(0, 0, 255);


$pdf->WriteHTML('<br><br><br>');
$pdf->Rect(7, 5, 197, 50, 'D');
//Cabezera
$col = array();
$col[] = array('text' => '', 'width' => '55', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.2', 'linearea' => '');
$col[] = array('text' => $Text, 'width' => '125', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '20', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '140,220,80', 'drawcolor' => '0,0,0', 'linewidth' => '0.2', 'linearea' => '');
$columns0[] = $col;
$pdf->WriteTable($columns0);


$pdf->AliasNbPages();
$pdf->SetMargins($pdf->left, $pdf->top, $pdf->right);
//$pdf->AddPage();

$pdf->WriteHTML('<br><br><br><br>');

$pdf->WriteHTML('<br><br><br><br><br><br><br>');
// create table
$columns = array();

$urlBBDD = 'https://'. $la_ip4. '/phpmyadmin';

$url = '<a href="' .$urlBBDD . '">'.$urlBBDD .'</a>';

// header 3
$col3 = array();
$col3[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
$col3[] = array('text' => 'Nuevo Dominio:', 'width' => '40', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col3[] = array('text' => $nombreDominio, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$columns3[] = $col3;
// Draw Table
$pdf->WriteTable($columns3);
$pdf->WriteHTML('<br><br>');
// header tupla
$col = array();
$col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => 'BBDD', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => '', 'width' => '140', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.2', 'linearea' => '');
$col[] = array('text' => 'BBDD', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.2', 'linearea' => '');
$col[] = array('text' => '', 'width' => '140', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.2', 'linearea' => '');
$columns[] = $col;
//color guapo para fondo '135,206,250'
// data tupla 1
$col = array();
$col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => 'Nombre:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => 'Nombre:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col[] = array('text' => $nombre_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$columns[] = $col;

// data tupla 2
$col = array();
$col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => 'Usuario:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => 'Usuario:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => $usuario_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$columns[] = $col;

// data tupla 3
$col = array();
$col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => 'Clave:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => 'Clave:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => $pass_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$columns[] = $col;

$pdf->SetTextColor(0, 0, 100);
// data tupla 3
$col = array();
$col[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => 'Url:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col[] = array('text' => $urlBBDD, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,90,255', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$columns[] = $col;

// Draw Table
$pdf->WriteTable($columns);
$pdf->WriteHTML('<br>');
// header tupla 2
$col2 = array();
$col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => 'FTP', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => 'FTP', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => '', 'width' => '140', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$columns2[] = $col2;

// data tupla 1
$col2 = array();
$col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => 'Usuario:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => 'Usuario:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col2[] = array('text' => $usuario_ftp, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$columns2[] = $col2;

// data tupla 2
$col2 = array();
$col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => 'Clave:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => 'Clave:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => $pass_ftp, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$columns2[] = $col2;

$col2 = array();
$col2[] = array('text' => '', 'width' => '8', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => 'Servidor:', 'width' => '21', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$col2[] = array('text' => $la_ip4, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
$columns2[] = $col2;

$pdf->WriteHTML('<br>');
$pdf->WriteTable($columns2);

// header 3
$col3 = array();
$col3[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
$col3[] = array('text' => 'Nuevo Dominio:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$col3[] = array('text' => $nombreDominio, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
$columns3[] = $col3;

$pdf->WriteHTML('<br><br>');
// Draw Table
$pdf->WriteTable($columns3);



//$pdf->AddPage();
@@ -396,7 +425,7 @@ $pdf->SetLink($link);
$pdf->Image('imagen/open6-logo.png',10,12,50,0,'','http://www.open6hosting.com');
$pdf->SetLeftMargin(12);
$pdf->SetFontSize(10);
$pdf->WriteHTML('<br><br><br><br><br><br>');
$pdf->WriteHTML('<br><br><br><br><br><br><br><br><br><br><br><br>');


//$pdf->WriteHTML($name);


+ 79
- 26
new_service_webdns.php Целия файл

@@ -71,7 +71,7 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.company_name, client.contact_name, client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$records = $app->db->queryAllRecords($sql, $client['client_id']);
@@ -202,6 +202,7 @@ class page_action extends tform_actions {
public $usuario_ftp_txt;
public $pass_ftp_txt;
public $nombre_user_ftp;
public $ip4_pdf;

function generaNombreFTP(){
@@ -409,14 +410,14 @@ class page_action extends tform_actions {
//}
//print "Cantidad de digitos: " . $min_password_length;
//print 'La clave ' . $this->generaPass();
$generated_usernameBBDD = $this->generaNombreBD();//$fields['client_id'].substr(sha1(rand()), 0, 10);//client_prefix.substr(sha1(rand()), 0, 8);
//print "<pre>"; print_r($generated_usernameBBDD); print "</pre>\n";
$sitio_id = $app->db->queryOneRecord('SELECT domain_id, domain FROM web_domain WHERE domain = "'.$fields['domain'].'"');
//print "<pre>"; print_r($camDnsRR); print "</pre>\n";
$camDnsRR = $app->db->queryOneRecord('SELECT server_id, zone FROM dns_rr WHERE name LIKE "'.$this->dominio.'%"');
//print "<pre>"; print_r($fields['client_id']); print "</pre>\n";
$clavePass = $this->generaPass();
//*Recupero todos los prefix necesarios
$app->uses('getconf,tools_sites');
@@ -424,13 +425,22 @@ class page_action extends tform_actions {
//$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
//$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);

if($fields['client_group_id']==0) {
$cliente_id_seleccionado = 1;
}else{
$cliente_id_seleccionadoCaptura = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');
$cliente_id_seleccionado = $cliente_id_seleccionadoCaptura['client_id'];
}


//print "<pre>"; print_r($cliente_id_seleccionado); print "</pre>\n";
//echo('El id cliente es ' . $cliente_id_seleccionado['client_id']);
// añado database user con su prefix
$db_user_params = array(
'server_id' => $camDnsRR['server_id'],
'sysgroup_id' => $fields['client_group_id'],
'sys_userid' => $fields['client_group_id'],
'sys_userid' => $cliente_id_seleccionado,
'database_user' => $generated_usernameBBDD, //$dbuser_prefix3 . $generated_usernameBBDD,
'database_user_prefix' => $this->valor_prefix,
'database_password' => $clavePass//substr(sha1($dbuser_prefix . $generated_usernameBBDD), 0, 16)
@@ -445,8 +455,17 @@ class page_action extends tform_actions {
//print "<br>". $this->pass_db_txt;

//print "<pre>"; print_r($fields); print "</pre>\n";
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $fields['client_group_id'], $db_user_params, 'sites:web_database_user:on_after_insert');
if($fields['client_group_id']==0) {
$cliente_id_seleccionado = 1;
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $cliente_id_seleccionado, $db_user_params, 'sites:web_database_user:on_after_insert');
}else{
$cliente_id_seleccionado = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $cliente_id_seleccionado['client_id'], $db_user_params, 'sites:web_database_user:on_after_insert');
}

//$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $cliente_id_seleccionado['client_id'], $db_user_params, 'sites:web_database_user:on_after_insert');
//echo('El id usuario: ' . $fields['client_group_id']);
// add database
$paramsBD = array(
'server_id' => $camDnsRR['server_id'],
@@ -467,9 +486,11 @@ class page_action extends tform_actions {

$this->nombre_db_txt = $paramsBD['database_name'];


$remoto->sites_database_add($fields['client_group_id'], $paramsBD);
if($fields['client_group_id']==0) {
$remoto->sites_database_add($cliente_id_seleccionado, $paramsBD);
}else{
$remoto->sites_database_add($cliente_id_seleccionado['client_id'], $paramsBD);
}
// get site data para usarlo en la creación de la cuenta ftp, otra forma de cargar una tupla dandole un id
//$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php');
@@ -500,13 +521,13 @@ class page_action extends tform_actions {
//print "<pre>"; print_r($ftp_params); print "</pre>\n";
//print "<pre>"; print_r($site_data); print "</pre>\n";
//echo('El usuario es ' . $fields['client_group_id']);
$remoto->insert_query('../sites/form/ftp_user.tform.php', $fields['client_group_id'], $ftp_params);
$remoto->insert_query('../sites/form/ftp_user.tform.php', $cliente_id_seleccionado/*fields['client_group_id']*/, $ftp_params);

echo '<br><div class="alert alert-success"><br>
Altas de BBDD y FTP, ¡Correctas!<br><br>
Usuario BBDD: <b>'. $this->usuario_db_txt .'</b><br>Contraseña: <b>' . $this->pass_db_txt . '
</b><br>Nombre BBDD: <b>' . $this->nombre_db_txt . '</b><br>
<br>Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>Contraseña: <b>' . $this->pass_ftp_txt . '</b><br><br>
<br>Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>Contraseña: <b>' . $this->pass_ftp_txt . '</b> <br><br>
</div></br>';

$hoy = date("d-m-Y H:i:s");
@@ -532,6 +553,7 @@ class page_action extends tform_actions {
echo '<input id="pass_bd" name="pass_bd" type="hidden" value="'.$this->pass_db_txt.'">';
echo '<input id="usuario_ftp" name="usuario_ftp" type="hidden" value="'.$this->usuario_ftp_txt.'">';
echo '<input id="pass_ftp" name="pass_ftp" type="hidden" value="'.$this->pass_ftp_txt.'">';
echo '<input id="ip4" name="ip4" type="hidden" value="'.$this->ip4_pdf.'">';
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$eldom.'">';
echo '<input type="submit" class="btn btn-default formbutton-success" value="Descargar PDF">';
echo '</form>';
@@ -596,6 +618,7 @@ class page_action extends tform_actions {
$this->onError();
return;
}

//print "<pre>El dominio es: " . $this->dominio;
//$camDominio = $app->db->queryOneRecord('SELECT domain_id, domain FROM domain WHERE domain = "'.$this->dominio.'"');
$camDominio = $app->db->queryOneRecord('SELECT origin FROM dns_soa WHERE origin LIKE "'.$this->dominio.'%"');
@@ -635,7 +658,14 @@ class page_action extends tform_actions {
//print "<pre>"; print_r($paramSubDominios); print "</pre>\n";
//Inserto en bbdd usando la clase remoto que se la he pasado en parámetros de la función
//$resultado = $remoto->insert_query('../dns/form/dns_a.tform.php', $fields['client_id'], $paramSubDominios);
$resultado = $remoto->insert_query('form/dns_a_webdns.tform.php', $fields['client_group_id'], $paramSubDominios);
if($fields['client_group_id']==0) {
$cliente_id_seleccionado = 1;
$resultado = $remoto->insert_query('form/dns_a_webdns.tform.php', $cliente_id_seleccionado /*$fields['client_group_id']*/, $paramSubDominios);
}else{
$cliente_id_seleccionado = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');
$resultado = $remoto->insert_query('form/dns_a_webdns.tform.php', $cliente_id_seleccionado['client_id'] /*$fields['client_group_id']*/, $paramSubDominios);
}

echo '<br><div class="alert alert-success"><br>
Se ha dado de alta Web y Subdominio, <b>'.$this->subdominio.'</b>, ¡Correctamente!
<br><br></div></br>';
@@ -649,6 +679,8 @@ class page_action extends tform_actions {
$fields = $app->tform->encode($this->dataRecord, $app->tform->getCurrentTab(), true);

//$cliente_id_seleccionado = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');

//Captura del servidor id
if($this->id > 0) {
$server_id = $this->dataRecord["server_id"];
@@ -659,7 +691,7 @@ class page_action extends tform_actions {
//$this->elServidor = $server_id;
}

$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE client_id = ".$fields['client_group_id']." AND ip_type='IPv6'");
//$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE client_id = ".$fields['client_group_id']." AND ip_type='IPv6'");
//Comprobamos que el resultado para el cliente seleccionado no esta vacío,
//si lo esta tomamos los datos del cliente id 0
@@ -670,10 +702,10 @@ class page_action extends tform_actions {
echo '<br><br>Valor de la consulta '.$dns_ip_servidor[ip_address].' ';*/
}

$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ".$app->functions->intval($fields['client_group_id']));
$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ". $cliente_id_seleccionado['client_id']/*$app->functions->intval($fields['client_group_id'])*/);
$clienteID = $dns_servidor['client_id'];

$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($fields['client_group_id']));
$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ". $clienteID/*$app->functions->intval($fields['client_group_id'])*/);
$client_group_id = $res['groupid'];
//Captura del servidor id
@@ -743,10 +775,20 @@ class page_action extends tform_actions {
//print '<pre>DNS IPV6 ' . $dns_ip_servidor_ipv6['ip_address'];

if($fields['client_group_id']==0) {
$cliente_id_seleccionado = 1;
$resultado = $remoto->insert_query('form/dns_a_webdns.tform.php', $cliente_id_seleccionado /*$fields['client_group_id']*/, $paramSubDominios);
$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE client_id = ".$cliente_id_seleccionado." AND ip_type='IPv6'");
}else{
$cliente_id_seleccionado = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');
$resultado = $remoto->insert_query('form/dns_a_webdns.tform.php', $cliente_id_seleccionado['client_id'] /*$fields['client_group_id']*/, $paramSubDominios);
$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE client_id = ".$cliente_id_seleccionado['client_id']/*$fields['client_group_id']*/." AND ip_type='IPv6'");
}

//$tform_def_file2 = "../sites/form/web_vhost_domain.tform.php";
//$app->tform->loadFormDef($tform_def_file2);
//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_group_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert');
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $clienteID/*$fields['client_group_id']*/, $paramsite, 'sites:web_vhost_domain:on_after_insert');

//print '<pre>ID sitio web del subdominio --> ' . $site_id;
}
@@ -757,8 +799,10 @@ class page_action extends tform_actions {

//Llamada a la tabla server_ip para recuperar la ip4 e ip6
$dns_ip_servidor = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE ip_type='IPv4'");
$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE ip_type='IPv6'");
$dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE ip_type='IPv6'");

$la_ip4 = $app->db->queryOneRecord("SELECT ip_type, ip_address FROM server_ip WHERE ip_type='IPv4'");
$this->ip4_pdf = $la_ip4['ip_address'];
/*print "<pre>IP4 ";print_r($dns_ip_servidor);print "</pre>\n";
print "<pre>IP6 ";print_r($dns_ip_servidor_ipv6);print "</pre>\n";*/

@@ -804,13 +848,22 @@ class page_action extends tform_actions {
//$this->elServidor = $server_id;
}

if($fields['client_group_id']==0) {
$cliente_id_seleccionado = 1;
}else{
$cliente_id_seleccionadoCaptura = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');
$cliente_id_seleccionado = $cliente_id_seleccionadoCaptura['client_id'];
}

//$cliente_id_seleccionado = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid ="'. $fields['client_group_id'] . '"');

//Este if lo he tomado de onAfterInsert del web_domain
/*if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'ru' WHERE domain_id = ?", $client_group_id, $this->id);
}*/
// client group id
$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($fields['client_group_id']));
$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE groupid = ".$app->functions->intval($fields['client_group_id']));
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);//$res['groupid'];
//echo ('El group id ' . $client_group_id . " ");

@@ -896,13 +949,13 @@ $dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FRO
//Llamada a la tabla client para recuperar el client_id y su default_dnsserver
$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ".$app->functions->intval($fields['client_group_id']));
$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ".$cliente_id_seleccionado/*$app->functions->intval($fields['client_group_id'])*/);
$valor_recuperado1 = $dns_servidor['client_id'];
/*$valor_recuperado2 = $dns_servidor['default_dnsserver'];
$valor_recuperado3 = $dns_servidor['default_webserver'];*/

// Insert the soa record
$sys_userid = $fields['client_group_id']; //$_SESSION['s']['user']['userid'];
$sys_userid = $dns_servidor['client_id'];//$fields['client_group_id']; //$_SESSION['s']['user']['userid'];
$origin = $vars['origin'];
$ns = $vars['ns'];
$mbox = str_replace('@', '.', $vars['mbox']);
@@ -917,7 +970,7 @@ $dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FRO
$serial = $app->validate_dns->increase_serial(0);

$insert_data = array(
"sys_userid" => $fields['client_group_id'],//$sys_userid,
"sys_userid" => $dns_servidor['client_id'],//$fields['client_group_id'],//$sys_userid,
"sys_groupid" => $client_group_id,
"sys_perm_user" => 'riud',
"sys_perm_group" => 'riud',
@@ -944,7 +997,7 @@ $dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FRO
if(is_array($dns_rr) && $dns_soa_id > 0) {
foreach($dns_rr as $rr) {
$insert_data = array(
"sys_userid" => $fields['client_group_id'],//$sys_userid,
"sys_userid" => $dns_servidor['client_id'],//$fields['client_group_id'],//$sys_userid,
"sys_groupid" => $client_group_id,
"sys_perm_user" => 'riud',
"sys_perm_group" => 'riud',
@@ -972,7 +1025,7 @@ $dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FRO
'type' => 'vhost',
'domain' => $fields['domain'],
'server_id' => $server_id,//$dns_servidor['default_webserver'],
'sys_userid' => $fields['client_group_id'],//$sys_userid,
'sys_userid' => $dns_servidor['client_id'],//$fields['client_group_id'],//$sys_userid,
'sys_groupid' => $client_group_id,
'ip_address' => '*', //$dns_ip_servidor['ip_address'],
'ipv6_address' => $dns_ip_servidor_ipv6['ip_address'],
@@ -1023,7 +1076,7 @@ $dns_ip_servidor_ipv6 = $app->db->queryOneRecord("SELECT ip_type, ip_address FRO
//print 'DNS IPV6 ' . $dns_ip_servidor_ipv6['ip_address'];

//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_group_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert');
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $dns_servidor['client_id']/*$fields['client_group_id']*/, $paramsite, 'sites:web_vhost_domain:on_after_insert');
//print 'Sitio id '. $site_id;
}



+ 2
- 0
pdf_o6h.php Целия файл

@@ -6,6 +6,7 @@ $usuario_bd = $_POST['usuario_bd'];
$pass_bd = $_POST['pass_bd'];
$usuario_ftp = $_POST['usuario_ftp'];
$pass_ftp = $_POST['pass_ftp'];
$ip4 = $_POST['ip4'];
$dominio_nuevo = $_POST['dominio_nuevo'];

echo "<body style='background-color:3c3c3c'>";
@@ -18,6 +19,7 @@ echo '<input id="usuario_bd" name="usuario_bd2" type="hidden" value="'.$usuario_
echo '<input id="pass_bd" name="pass_bd2" type="hidden" value="'.$pass_bd.'">';
echo '<input id="usuario_ftp" name="usuario_ftp2" type="hidden" value="'.$usuario_ftp.'">';
echo '<input id="pass_ftp" name="pass_ftp2" type="hidden" value="'.$pass_ftp.'">';
echo '<input id="ip4" name="ip4" type="hidden" value="'.$ip4.'">';
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$dominio_nuevo.'">';
echo '</form>';



Loading…
Отказ
Запис