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