include "fpdf153/fpdf.php";
include "banco.php";
class FeBPDF extends FPDF {
function Footer() {
$this->SetY(-15);
$this->SetFont('Arial','I',8);
$this->Cell(0,10,'http://fanfic.potterish.com/ ^o^ http://www.potterish.com ^o^ http://forum.potterish.com ^o^ ('.$this->PageNo().' de {nb})',0,0,'C');
}
}
$caracteres = array("
","
","
","
","","","","","
");
$brancos = array("","","","","","","","","");
//$nomeCaracteres = array("\\","/",":","*","?","<",">","|","ç","ã");
//$nomeBrancos = array("","","","","","","","","c","a");
$pdf=new FeBPDF('P','mm','A4');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','',16);
$pdf->Cell(0,0,'Fanfics - Floreios e Borrões',0,1,'C');
$pdf->Ln(45);
$query1 = "select F.Resumo as Res,F.Nome as NomeFic,F.tabelaCap as tab,F.idAutor as idAut,U.Nome as uNome from Fic as F inner join User as U on U.id=F.idAutor where U.Vip = 1 and F.Status=1 and F.id=".$id;
$resultado1 = mysql_query($query1,$conexao);
if (mysql_num_rows($resultado1)==0) {
exit();
}
while ($linha1=mysql_fetch_array($resultado1)) {
$numChapter = $linha1["tab"];
$idAutor = $linha1["idAut"];
$nomeAutor = $linha1["uNome"];
//$n = str_replace($nomeCaracteres,$nomeBrancos,$linha1["NomeFic"]);
$pdf->SetFont('Arial','B',20);
$pdf->MultiCell(0,8,$linha1["NomeFic"],0,"C");
$pdf->Ln(15);
$pdf->SetFont('Arial','',12);
$pdf->MultiCell(0,5,"de",0,"C");
$pdf->Ln(15);
$pdf->SetFont('Arial','I',16);
$pdf->MultiCell(0,5,$nomeAutor,0,"C");
$pdf->Ln(30);
$pdf->SetFont('Arial','',10);
//$resumo = str_replace($caracteres,$brancos,$linha1["Res"]);
$resumo = $linha1["Res"];
$pdf->MultiCell(0,5,"RESUMO: ".$resumo,0,"J");
}
$query2 = "select Numero,Nome,Texto from Chapter$numChapter where idFic=$id order by Numero";
$resultado2 = mysql_query($query2,$conexao);
while ($linha2=mysql_fetch_array($resultado2)) {
$pdf->AddPage();
$pdf->SetFont('Times','',16);
//$nome = str_replace($caracteres,$brancos,$linha2["Nome"]);
$nome = $linha2["Nome"];
$pdf->MultiCell(0,5,"- ".$linha2["Numero"]." -\n".$nome,0,"C");
$pdf->Ln(10);
$pdf->SetFont('Times','',11);
//$texto = str_replace($caracteres,$brancos,$linha2["Texto"]);
$texto = html_entity_decode(strip_tags($linha2["Texto"]),ENT_NOQUOTES);
$pdf->MultiCell(0,5,$texto);
}
mysql_close($conexao);
$pdf->Output("Fanfic-FeB-".$id.".pdf","D");
?>