File "code_pdf.php"
Full Path: /home/analogde/www/DOSSIER/Massage_admin/code_pdf.php
File size: 3.23 KB
MIME-type: text/x-php
Charset: utf-8
<?php
header( 'content-type: text/html; charset=utf-8' );
include('database.php');
include('fonctions.php');
DB_connexion();
require('html_table.php');
$annee = date('Y');
$table = "reservation" .$annee;
$mois = "avril";
$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and mois ='$mois' and mode = 'actif' ";
//echo $sql;
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
$tab_jour = array();
$message = '
<TABLE>
<TR>
<TD>Jour</TD>
<TD>12H20</TD>
<TD>12H40</TD>
<TD>13H00</TD>
<TD>13H20</TD>
<TD>13H40</TD>
<TD>14H00</TD>
<TD>14H20</TD>
<TD>14H40</TD>
</TR>';
while ($data = mysqli_fetch_assoc ($result))
{
$jour = $data['rendezvous'];
$jour = substr($jour, 0, 5);
$semaine = $data['semaine'];
$seance1 = $data['seance1'];
$seance2 = $data['seance2'];
$seance3 = $data['seance3'];
$seance4 = $data['seance4'];
$seance5 = $data['seance5'];
$seance6 = $data['seance6'];
$seance7 = $data['seance7'];
$seance8 = $data['seance8'];
$message .= "
<TR>
<TD>$jour</TD>
<TD>$seance1</TD>
<TD>$seance2</TD>
<TD>$seance3</TD>
<TD>$seance4</TD>
<TD>$seance5</TD>
<TD>$seance6</TD>
<TD>$seance7</TD>
<TD>$seance8</TD>
</TR> ";
}
$message .= "</TABLE>";
//echo $message;
$monfichier = fopen('compteur.php', 'a+');
file_put_contents('compteur.php', ''); // écrase le contenu du fichier
fputs($monfichier, "<?php\n");
fputs($monfichier, "require('html_table.php');\n");
fputs($monfichier, '$htmlTable=');
fputs($monfichier, "'");
fputs($monfichier, $message);
fputs($monfichier, "';");
fputs($monfichier, "\n");
fputs($monfichier, '$pdf=new PDF_HTML_Table();');
fputs($monfichier, "\n");
fputs($monfichier, '$pdf->AddPage();');
fputs($monfichier, "\n");
fputs($monfichier, '$pdf->SetFont("Arial","",10);');
fputs($monfichier, "\n");
//fputs($monfichier, '$pdf->WriteHTML("Start of the HTML table.<BR>$htmlTable<BR>End of the table.");');
fputs($monfichier, '$pdf->WriteHTML("Rendez-vous:<BR>$htmlTable<BR>Patrice Delpy 2015.");');
fputs($monfichier, "\n");
//fputs($monfichier, '$pdf->Cell(40,10,"$mois")');
fputs($monfichier, "\n");
fputs($monfichier, '$pdf->Output("test.pdf","F");');
//Output('./pdfs/test.pdf', 'F');
fputs($monfichier, "\n");
fputs($monfichier, '?>');
fclose($monfichier);
/*
$htmlTable='<TABLE>
<TR>
<TD>S. No.</TD>
<TD>Name</TD>
<TD>Age</TD>
<TD>Sex</TD>
<TD>Location</TD>
</TR>
<TR>
<TD>1</TD>
<TD>Azeem</TD>
<TD>24</TD>
<TD>Male</TD>
<TD>Pakistan</TD>
</TR>
<TR>
<TD>2</TD>
<TD>Atiq</TD>
<TD>24</TD>
<TD>Male</TD>
<TD>Pakistan</TD>
</TR>
<TR>
<TD>3</TD>
<TD>Shahid</TD>
<TD>24</TD>
<TD>Male</TD>
<TD>Pakistan</TD>
</TR>
<TR>
<TD>4</TD>
<TD>Roy Montgome</TD>
<TD>36</TD>
<TD>Male</TD>
<TD>USA</TD>
</TR>
<TR>
<TD>5</TD>
<TD>M.Bony</TD>
<TD>18</TD>
<TD>Female</TD>
<TD> </TD>
</TR>
</TABLE>';
*/
/*$pdf=new PDF_HTML_Table();
$pdf->AddPage();
$pdf->SetFont('Arial','',10);
$pdf->WriteHTML("Start of the HTML table.<BR>$htmlTable<BR>End of the table.");
$pdf->Output();*/
?>