PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/mybookbag/old/xampp/cds.php

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