home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / cds.php < prev    next >
Encoding:
PHP Script  |  2004-03-22  |  4.4 KB  |  148 lines

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