home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / phonebook.php < prev    next >
Encoding:
Text File  |  2003-11-24  |  3.8 KB  |  116 lines

  1. <html>
  2. <head>
  3. <title>XAMPP phonebook</title>
  4. <link href="xampp.css" rel="stylesheet" type="text/css">
  5. </head>
  6.  
  7. <body>
  8. <? include("lang/".file_get_contents("lang.tmp").".php"); ?>
  9.  
  10.  <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 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=sqlite_open('sqlite/phonebook', '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.     if($firstname!="")
  56.     {
  57.         sqlite_query($db,"INSERT INTO users (firstname,lastname,phone) VALUES('$firstname','$lastname','$phone')");
  58.     }
  59.  
  60.     if($action=="del")
  61.     {
  62.         sqlite_query($db,"DELETE FROM users WHERE id=$id;");
  63.     }
  64.  
  65.     $result=sqlite_query($db,"SELECT id,firstname,lastname,phone FROM users ORDER BY lastname;");
  66.     
  67.     $i=0;
  68.     while( $row=sqlite_fetch_array($result) )
  69.     {
  70.         if($i>0)
  71.         {
  72.             echo "<tr valign=bottom>";
  73.             echo "<td bgcolor=#ffffff background='img/strichel.gif' colspan=6><img src=img/blank.gif width=1 height=1></td>";
  74.             echo "</tr>";
  75.         }
  76.         echo "<tr valign=center>";
  77.         echo "<td class=tabval><img src=img/blank.gif width=10 height=20></td>";
  78.         echo "<td class=tabval><b>".$row['lastname']."</b></td>";
  79.         echo "<td class=tabval>".$row['firstname']." </td>";
  80.         echo "<td class=tabval>".$row['phone']." </td>";
  81.  
  82.         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>";
  83.         echo "<td class=tabval></td>";
  84.         echo "</tr>";
  85.         $i++;
  86.  
  87.     }
  88.  
  89.     echo "<tr valign=bottom>";
  90.         echo "<td bgcolor=#fb7922 colspan=6><img src=img/blank.gif width=1 height=8></td>";
  91.         echo "</tr>";
  92.  
  93.     sqlite_close($db);
  94.  
  95. ?>
  96.  
  97. </table>
  98.  
  99. <h2><?=$TEXT['phonebook-head2']?></h2>
  100.  
  101. <form action=phonebook.php method=get>
  102. <table border=0 cellpadding=0 cellspacing=0>
  103. <tr><td><?=$TEXT['phonebook-attrib1']?>:</td><td><input type=text size=20 name=lastname></td></tr>
  104. <tr><td><?=$TEXT['phonebook-attrib2']?>:</td><td> <input type=text size=20 name=firstname></td></tr>
  105. <tr><td><?=$TEXT['phonebook-attrib3']?>:</td><td> <input type=text size=20 name=phone></td></tr>
  106. <tr><td></td><td><input type=submit border=0 value="<?=$TEXT['phonebook-button2']?>"></td></tr>
  107. </table>
  108. </form>
  109. <p>
  110. <? if ($source=="in")
  111.         { include("code.php"); $beispiel = $SCRIPT_FILENAME; pagecode($beispiel);} 
  112.         else
  113.         { print("<p><br><br><h2><U><a href=\"$PHP_SELF?source=in\">".$TEXT['srccode-in']."</a></U></h2>");} ?> 
  114. </body>
  115. </html>
  116.