PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/mybookbag/old/xampp/cds-fpdf.php

https://bitbucket.org/s2223902/mybookbag
PHP | 160 lines | 112 code | 33 blank | 15 comment | 6 complexity | 1e65a583176d302548204ad4aab10d2c MD5 | raw file
  1. <?php
  2. if($_REQUEST['action']=="getpdf")
  3. {
  4. mysql_connect("localhost","root","");
  5. mysql_select_db("cdcol");
  6. include ('fpdf.php');
  7. $pdf =& new FPDF();
  8. $pdf->AddPage();
  9. $pdf->SetFont('Helvetica','',14);
  10. $pdf->Write(5, 'CD Collection');
  11. $pdf->Ln();
  12. $pdf->SetFontSize(10);
  13. $pdf->Write(5, '© 2002/2003 Kai Seidler, oswald@apachefriends.org, GPL');
  14. $pdf->Ln();
  15. $pdf->Ln(5);
  16. $pdf->SetFont('Helvetica','B',10);
  17. $pdf->Cell(40,7,'interpret',1);
  18. $pdf->Cell(80,7,'titel',1);
  19. $pdf->Cell(40,7,'jahr',1);
  20. $pdf->Ln();
  21. $pdf->SetFont('Helvetica','',10);
  22. $result=mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;");
  23. while( $row=mysql_fetch_array($result) )
  24. {
  25. $pdf->Cell(40,7,$row['interpret'],1);
  26. $pdf->Cell(80,7,$row['titel'],1);
  27. $pdf->Cell(40,7,$row['jahr'],1);
  28. $pdf->Ln();
  29. }
  30. $pdf->Output();
  31. exit;
  32. }
  33. ?>
  34. <?php include("langsettings.php"); ?>
  35. <html>
  36. <head>
  37. <title>apachefriends.org cd collection</title>
  38. <link href="xampp.css" rel="stylesheet" type="text/css">
  39. </head>
  40. <body>
  41. &nbsp;<p>
  42. <h1><?php print $TEXT['cds-head-fpdf']; ?></h1>
  43. <?php print $TEXT['cds-text1']; ?><p>
  44. <?php print $TEXT['cds-text2']; ?><p>
  45. <?php
  46. // Copyright (C) 2002/2003 Kai Seidler, oswald@apachefriends.org
  47. //
  48. // This program is free software; you can redistribute it and/or modify
  49. // it under the terms of the GNU General Public License as published by
  50. // the Free Software Foundation; either version 2 of the License, or
  51. // (at your option) any later version.
  52. //
  53. // This program is distributed in the hope that it will be useful,
  54. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  55. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  56. // GNU General Public License for more details.
  57. //
  58. // You should have received a copy of the GNU General Public License
  59. // along with this program; if not, write to the Free Software
  60. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  61. if(!mysql_connect("localhost","root",""))
  62. {
  63. echo "<h2>".$TEXT['cds-error']."</h2>";
  64. die();
  65. }
  66. mysql_select_db("cdcol");
  67. ?>
  68. <h2><?php print $TEXT['cds-head1']; ?></h2>
  69. <table border=0 cellpadding=0 cellspacing=0>
  70. <tr bgcolor=#f87820>
  71. <td><img src=img/blank.gif width=10 height=25></td>
  72. <td class=tabhead><img src=img/blank.gif width=200 height=6><br><b><?php print $TEXT['cds-attrib1']; ?></b></td>
  73. <td class=tabhead><img src=img/blank.gif width=200 height=6><br><b><?php print $TEXT['cds-attrib2']; ?></b></td>
  74. <td class=tabhead><img src=img/blank.gif width=50 height=6><br><b><?php print $TEXT['cds-attrib3']; ?></b></td>
  75. <td class=tabhead><img src=img/blank.gif width=50 height=6><br><b><?php print $TEXT['cds-attrib4']; ?></b></td>
  76. <td><img src=img/blank.gif width=10 height=25></td>
  77. </tr>
  78. <?php
  79. if($_REQUEST['interpret']!="")
  80. {
  81. if($jahr=="")$jahr="NULL";
  82. $titel=htmlentities($_REQUEST['titel']);
  83. $interpret=htmlentities($_REQUEST['interpret']);
  84. $jahr=htmlentities($_REQUEST['jahr']);
  85. mysql_query("INSERT INTO cds (titel,interpret,jahr) VALUES('$titel','$interpret',$jahr);");
  86. }
  87. if($_REQUEST['action']=="del")
  88. {
  89. mysql_query("DELETE FROM cds WHERE id=$id;");
  90. }
  91. $result=mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;");
  92. $i=0;
  93. while( $row=mysql_fetch_array($result) )
  94. {
  95. if($i>0)
  96. {
  97. echo "<tr valign=bottom>";
  98. echo "<td bgcolor=#ffffff background='img/strichel.gif' colspan=6><img src=img/blank.gif width=1 height=1></td>";
  99. echo "</tr>";
  100. }
  101. echo "<tr valign=center>";
  102. echo "<td class=tabval><img src=img/blank.gif width=10 height=20></td>";
  103. echo "<td class=tabval><b>".$row['interpret']."</b></td>";
  104. echo "<td class=tabval>".$row['titel']."&nbsp;</td>";
  105. echo "<td class=tabval>".$row['jahr']."&nbsp;</td>";
  106. echo "<td class=tabval><a onclick=\"return confirm('".$TEXT['cds-sure']."');\" href=cds.php?action=del&id=".$row['id']."><span class=red>[".$TEXT['cds-button1']."]</span></a></td>";
  107. echo "<td class=tabval></td>";
  108. echo "</tr>";
  109. $i++;
  110. }
  111. echo "<tr valign=bottom>";
  112. echo "<td bgcolor=#fb7922 colspan=6><img src=img/blank.gif width=1 height=8></td>";
  113. echo "</tr>";
  114. ?>
  115. </table>
  116. <h2><?php print $TEXT['cds-head2']; ?></h2>
  117. <form action=cds.php method=get>
  118. <table border=0 cellpadding=0 cellspacing=0>
  119. <tr><td><?php print $TEXT['cds-attrib1']; ?>:</td><td><input type=text size=30 name=interpret></td></tr>
  120. <tr><td><?php print $TEXT['cds-attrib2']; ?>:</td><td> <input type=text size=30 name=titel></td></tr>
  121. <tr><td><?php print $TEXT['cds-attrib3']; ?>:</td><td> <input type=text size=5 name=jahr></td></tr>
  122. <tr><td></td><td><input type=submit border=0 value="<?php print $TEXT['cds-button2']; ?>"></td></tr>
  123. </table>
  124. </form>
  125. <?php include("showcode.php"); ?>
  126. </body>
  127. </html>