comparison _xampp/cds-fpdf.php @ 0:b12c99b7c3f0

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