comparison _xampp/phonebook.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 <? include("langsettings.php"); ?>
2 <html>
3 <head>
4 <title>XAMPP phonebook</title>
5 <link href="xampp.css" rel="stylesheet" type="text/css">
6 </head>
7
8 <body>
9
10 &nbsp;<p>
11 <h1><?=$TEXT['phonebook-head']?></h1>
12
13 <?=$TEXT['phonebook-text1']?><p>
14 <?=@$TEXT['phonebook-text2']?><p>
15
16 <?
17
18 // Copyright (C) 2003-2004 Kai Seidler, oswald@apachefriends.org
19 //
20 // This program is free software; you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation; either version 2 of the License, or
23 // (at your option) any later version.
24 //
25 // This program is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 // GNU General Public License for more details.
29 //
30 // You should have received a copy of the GNU General Public License
31 // along with this program; if not, write to the Free Software
32 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33
34 if(!($db=new SQLite3('sqlite/phonebook.sqlite3', '0666')))
35 {
36 echo "<h2>".$TEXT['phonebook-error']."</h2>";
37 die();
38 }
39 ?>
40
41 <h2><?=$TEXT['phonebook-head1']?></h2>
42
43 <table border=0 cellpadding=0 cellspacing=0>
44 <tr bgcolor=#f87820>
45 <td><img src=img/blank.gif width=10 height=25></td>
46 <td class=tabhead><img src=img/blank.gif width=150 height=6><br><b><?=$TEXT['phonebook-attrib1']?></b></td>
47 <td class=tabhead><img src=img/blank.gif width=150 height=6><br><b><?=$TEXT['phonebook-attrib2']?></b></td>
48 <td class=tabhead><img src=img/blank.gif width=150 height=6><br><b><?=$TEXT['phonebook-attrib3']?></b></td>
49 <td class=tabhead><img src=img/blank.gif width=50 height=6><br><b><?=$TEXT['phonebook-attrib4']?></b></td>
50 <td><img src=img/blank.gif width=10 height=25></td>
51 </tr>
52
53
54 <?
55 $firstname=$db->escapeString(@$_REQUEST['firstname']);
56 $lastname=$db->escapeString(@$_REQUEST['lastname']);
57 $phone=$db->escapeString(@$_REQUEST['phone']);
58
59 if($firstname!="")
60 {
61 $db->query("INSERT INTO users (firstname,lastname,phone) VALUES('$firstname','$lastname','$phone')");
62 }
63
64 if(@$_REQUEST['action']=="del")
65 {
66 $db->query("DELETE FROM users WHERE id=".round($_REQUEST['id']));
67 }
68
69 $result=$db->query("SELECT id,firstname,lastname,phone FROM users ORDER BY lastname;");
70
71 $i=0;
72 while( $row=$result->fetchArray(SQLITE3_ASSOC) )
73 {
74 if($i>0)
75 {
76 echo "<tr valign=bottom>";
77 echo "<td bgcolor=#ffffff background='img/strichel.gif' colspan=6><img src=img/blank.gif width=1 height=1></td>";
78 echo "</tr>";
79 }
80 echo "<tr valign=center>";
81 echo "<td class=tabval><img src=img/blank.gif width=10 height=20></td>";
82 echo "<td class=tabval><b>".htmlspecialchars($row['lastname'])."</b></td>";
83 echo "<td class=tabval>".htmlspecialchars($row['firstname'])."&nbsp;</td>";
84 echo "<td class=tabval>".htmlspecialchars($row['phone'])."&nbsp;</td>";
85
86 echo "<td class=tabval><a onclick=\"return confirm('".$TEXT['phonebook-sure']."');\" href=phonebook.php?action=del&id=".$row['id']."><span class=red>[".$TEXT['phonebook-button1']."]</span></a></td>";
87 echo "<td class=tabval></td>";
88 echo "</tr>";
89 $i++;
90
91 }
92
93 echo "<tr valign=bottom>";
94 echo "<td bgcolor=#fb7922 colspan=6><img src=img/blank.gif width=1 height=8></td>";
95 echo "</tr>";
96
97 $db->close();
98
99 ?>
100
101 </table>
102
103 <h2><?=$TEXT['phonebook-head2']?></h2>
104
105 <form action=phonebook.php method=get>
106 <table border=0 cellpadding=0 cellspacing=0>
107 <tr><td><?=$TEXT['phonebook-attrib1']?>:</td><td><input type=text size=20 name=lastname></td></tr>
108 <tr><td><?=$TEXT['phonebook-attrib2']?>:</td><td> <input type=text size=20 name=firstname></td></tr>
109 <tr><td><?=$TEXT['phonebook-attrib3']?>:</td><td> <input type=text size=20 name=phone></td></tr>
110 <tr><td></td><td><input type=submit border=0 value="<?=$TEXT['phonebook-button2']?>"></td></tr>
111 </table>
112 </form>
113 <? include("showcode.php"); ?>
114
115
116 </body>
117 </html>