Tema: Tcpdf
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 05/11/2010, 09:28
juancondarts
 
Fecha de Ingreso: julio-2010
Mensajes: 70
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Tcpdf

Esta es la primer mitad del codigo , a continuacion te mando la segunda mitad



<?php require_once('Connections/ingresotiradores.php'); ?>
<?php require_once('Connections/admin_fecba.php'); ?>
<?php
//require('/fpdf16/fpdf.php');
require_once('/tcpdf_5_9_011/tcpdf/tcpdf.php');
require_once('/tcpdf_5_9_011/tcpdf/config/lang/spa.php');

//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "inicio.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "loginainscripcion.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}


$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO inscripciones (nombretorneo, Apellido, sexo, mail, categoria, arma, sala, maestro, provincia, telefono, Nombre) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombretorneo'], "text"),
GetSQLValueString($_POST['Apellido'], "text"),
GetSQLValueString($_POST['sexo'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['arma'], "text"),
GetSQLValueString($_POST['sala'], "text"),
GetSQLValueString($_POST['maestro'], "text"),
GetSQLValueString($_POST['provincia'], "text"),
GetSQLValueString($_POST['telefono'], "text"),
GetSQLValueString($_POST['Nombre'], "text"));

mysql_select_db($database_ingresotiradores, $ingresotiradores);
$Result1 = mysql_query($insertSQL, $ingresotiradores) or die(mysql_error());



$insertGoTo = "inicio.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}






// class PDF extends FPDF
// {
// //Cabecera de página
// function Header()
// {
// $this->Image('Logo_Fecba.jpg',10,10,100);
// $this->SetFont('Arial','','14');
// $this->Cell(0,10,'Federación de Esgrima mde la Ciudad de Buenos Aires',1,0,'R');
// }
// }



$pdf=new TCPDF('P','mm','A4');
$pdf->AddPage();
$pdf->SetFont('helvetica','U','14');
$pdf->Cell(30,10,'Federacion de Esgrima de la Ciudad de Buenos Aires',0,1,'L');
$pdf->Ln(5);
$pdf->SetFont('helvetica','B',10);
if ($_POST['sexo']=='F'){
$pdf->Cell(57,10,'Se deja constancia que la tiradora ',0,0,'L');

$pdf->Cell(50,10,$_POST['Nombre']." ".$_POST['Apellido'],0,1,'L');
}
if ($_POST['sexo']=='M'){
$pdf->Cell(57,10,'Se deja constancia que el tirador ',0,0,'L');
$pdf->Cell(50,10,$_POST['Nombre']." ".$_POST['Apellido'],0,1,'L');
}
$pdf->Cell(54,10,'se ha inscripto para el torneo: ',0,0,'L');
$pdf->Cell(0,10,$_POST['nombretorneo'],0,1);
$pdf->Cell(24,10,'Categoria : ',0,0,'L');
$pdf->Cell(0,10,$_POST['categoria'],0,1);
$pdf->Cell(24,10,'Arma : ',0,0,'L');
$pdf->Cell(20,10,$_POST['arma'],0,1);
$pdf->Cell(24,10,'Sala : ',0,0,'L');
$pdf->Cell(0,10,$_POST['sala'],0,1);
$pdf->Cell(24,10,'Maestro : ',0,0,'L');
$pdf->Cell(0,10,$_POST['maestro'],0,1);
$pdf->Cell(24,10,'Telefono : ',0,0,'L');
$pdf->Cell(0,10,$_POST['telefono'],0,1);
$fecha = date("d-m-y --- h : i : s A");
$pdf->Cell(50,10,'Fecha y hora de inscripcion : ');
$pdf->Cell(40,10,$fecha);
$pdf->AddPage();


$pdf->Output('C:\Constancia_de_Inscripcion.pdf' , 'F');





header(sprintf("Location: %s", $insertGoTo));



















}


mysql_select_db($database_ingresotiradores, $ingresotiradores);
$query_Seleccionartorneos = "SELECT * FROM basetorneos WHERE habilitada = 'Y'";
$Seleccionartorneos = mysql_query($query_Seleccionartorneos, $ingresotiradores) or die(mysql_error());
$row_Seleccionartorneos = mysql_fetch_assoc($Seleccionartorneos);
$totalRows_Seleccionartorneos = mysql_num_rows($Seleccionartorneos);

$colname_quienentro = "-1";
if (isset($_GET['id'])) {
$colname_quienentro = $_GET['id'];
}
mysql_select_db($database_ingresotiradores, $ingresotiradores);
$query_quienentro = sprintf("SELECT Apellido, sexo, mail, numdoc, Nombre FROM basetiradores WHERE numdoc = %s", GetSQLValueString($colname_quienentro, "int"));
$quienentro = mysql_query($query_quienentro, $ingresotiradores) or die(mysql_error());
$row_quienentro = mysql_fetch_assoc($quienentro);
$totalRows_quienentro = mysql_num_rows($quienentro);

mysql_select_db($database_admin_fecba, $admin_fecba);
$query_salas = "SELECT * FROM basesalas";
$salas = mysql_query($query_salas, $admin_fecba) or die(mysql_error());
$row_salas = mysql_fetch_assoc($salas);
$totalRows_salas = mysql_num_rows($salas);


?>