SHARE
TWEET

Untitled

a guest Feb 24th, 2017 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ■test28.php
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xm1ns="http://www.w3.org/1999/xhtml">
  5. <html lang="ja">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <meta http-equiv="Content-Script-Type" content="text/javascript">
  9.  
  10.  
  11. <title>単語集</title>
  12. </head>
  13. <body>
  14.     <style type="text/css">
  15. <!--
  16. BODY {
  17.     background-image: url(chocolate3-2.jpg);
  18.     background-repeat: no-repeat;
  19.     background-attachment: fixed;
  20.     background-position: right top;
  21. }
  22.  
  23. -->
  24. .font1 {
  25.     font-family: "あずきフォント";
  26. }
  27.  
  28. .font2 {
  29.     font-family: "あずきフォント";
  30.     font-size: 160%;
  31.     color: "#e4b9f9";
  32. }
  33.  
  34. .font3 {
  35.     /*  padding: 4px; */
  36.     /*  font-family: "あずきフォント"; */
  37. }
  38. .font4 {
  39.     position:relative;left:15px;
  40. }
  41. .font5 {
  42.     border-collapse: collapse; /* 枠線の表示方法 */
  43.     border: 1px #1C79C6 solid; /* テーブル全体の枠線(太さ・色・スタイル) */
  44. }
  45.  
  46. .font {
  47.     font-family: "あずきフォント";
  48.     font-size: 160%;
  49.     color: "white";
  50. }
  51.  
  52. .body {
  53.     cursor: url(hosi5.ani);
  54. }
  55.  
  56. @font-face {
  57.     font-family: 'あずきフォント'; /* お好きな名前に */
  58.     src: url('azuki.eot'); /* IE9以上用 */
  59.     src: url('azuki.eot?#iefix') format('embedded-opentype'), /* IE8以前用 */
  60.         url('azuki.woff') format('woff'), /* モダンブラウザ用 */
  61.         url('azuki.ttf') format('truetype'); /* iOS, Android用 */
  62. }
  63.  
  64. html,body {
  65.     scrollbar-base-color: #c3d7e0;
  66.     scrollbar-track-color: #c3d7e0;
  67.     scrollbar-face-color: #c3d7e0;
  68.     scrollbar-shadow-color: #c3d7e0;
  69.     scrollbar-darkshadow-color: #c3d7e0;
  70.     scrollbar-highlight-color: #c3d7e0;
  71.     scrollbar-3dlight-color: #c3d7e0;
  72.     scrollbar-arrow-color: #ffffff;
  73.     filter: chroma(color = #c3d7e0);
  74. }
  75. </style>
  76.         <table bgcolor="#882200" cellpadding="2" cellspacing="0">
  77. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  78. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  79. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  80. <td style="border:hotpink 1px solid;" rowspan="3" bgcolor="lightpink">
  81. <p>
  82. <p class="font1" ><font color="white"></br>検索したい文字を入力して下さい</font></p>
  83. <form action="" method="post">
  84. <input type="hidden" name="command1" value="search">
  85. <input type="text" name="keyword">
  86. <input type="submit" value="検索"style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;position:relative;left:20px;">
  87. </form>
  88. </p>
  89. <P align="right"><font size="2" color="hotpink">■■■</font></td>
  90. </tr>
  91. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  92. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  93. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td></tr>
  94. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  95. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  96. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td></tr>
  97. </table>
  98. <!--    ノートに書く -->
  99.     <table bgcolor="#882200" cellpadding="2" cellspacing="0">
  100. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  101. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  102. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  103. <td style="border:hotpink 1px solid;" rowspan="3" bgcolor="lightpink">
  104.         <p>
  105.         <img src="res-19.gif"><font color="white" class="font1">ノートに書く</font>
  106.         </p>
  107.         <p>
  108.         <form action="" method="post">
  109.         <font color="white" class="font1">ことば<input type="text" size="10" name="word">
  110.         意味<input type="text" size="30" name="sense"></br>
  111.         メモ<input type="text" class="font4" size="20" name="memo">
  112.         <input type="hidden" name="command" value="insert">
  113.         <input type="submit"  value="書く" style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;position:relative;left:20px;">
  114.         </form>
  115.         </p>
  116.  
  117.  
  118.  
  119. <P align="right"><font size="2" color="hotpink">■■■</font></td>
  120. </tr>
  121. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  122. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  123. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td></tr>
  124. <tr><td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  125. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td>
  126. <td style="border-top:chocolate 1px solid;border-left:chocolate 1px solid;border-bottom:black 1px solid;border-right:black 1px solid;" width="20" height="25" valign="bottom" align="right"><font color="peru" size="1"><b>」</b></font></td></tr>
  127. </table>
  128.     <form action="" method="post">
  129.     <button type="submit" name='button4' value='button4' style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;">修正</button>
  130.     </form>
  131.     <form action="" method="post">
  132.     <input type="hidden" name="command" value="listDisplay">
  133.     <input type="submit"  value="一覧表示" style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;">
  134.     </form>
  135. <!-- <table border="1" style="border-color:#6c2735; border-style:solid; border-width: 2px;" cellpading="0" border="1" width="80%"> -->
  136. <!--    <table class="font5"  cellpading="0" border="1" width="80%"> -->
  137.     <table bgcolor="white" width="80%"  rules="all" cellpading="0" border="1" style="border-color:brown;border-width:1px; border-style:solid;">
  138.         <caption class="font2">単語集</caption>
  139.         <tr style="background: #882200">
  140. <!--            <th width="30" height="35" class="font1"><font color="white">番号</font></th> -->
  141.             <th width="30" height="35" class="font1"><font color="white">ことば</font></th>
  142.             <th width="30" height="35" class="font1"><font color="white">意味</font></th>
  143.             <th width="30" height="35" class="font1"><font color="white">メモ</font></th>
  144.             <?php
  145.             if(isset($_POST['button4'])){
  146.                 echo '<th width="30" height="35" class="font1"><font color="white">更新</font></th>
  147.                     <th width="30" height="35" class="font1"><font color="white">削除</font></th>';
  148.                 }
  149.             ?>
  150.         </tr>
  151. <?php
  152. function h($str) {
  153.     return htmlspecialchars($str);
  154. }
  155. $pdo = new PDO('mysql:host=localhost;dbname=takahashi1;charset=utf8', 'takahashi', 'takahashi' );
  156. // もし修正ボタンが押されたら
  157. if ($_POST ['button4']) {
  158.     foreach ( $pdo->query ('select * from words order by id desc') as $row ) {
  159.         echo '<tr>';
  160.         echo '<form action="" method = "post">';
  161.         echo '<input type="hidden" name="command" value="update">';
  162.         echo '<input type="hidden" name="id" value="', $row ['id'], '">';
  163. //      echo '<td>', $row ['id'], '</td>';
  164.         echo '<td>';
  165.         echo '<input type="text" name="word" size="10" value="', $row ['word'], '">';
  166.         echo '</td>';
  167.         echo '<td>';
  168.         echo '<input type="text" name="sense" size="40" value="', $row ['sense'], '">';
  169.         echo '</td>';
  170.         echo '<td>';
  171.         echo '<input type="text" name="memo" size="20" value="', $row ['memo'], '">';
  172.         echo '</td>';
  173.         echo '<td><button type="submit" style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;">更新</button></td>';
  174.         echo '</form>';
  175.         echo '<form action="" method="post">';
  176.         echo '<input type="hidden" name="command" value="delete">';
  177.         echo '<input type="hidden" name="id" value="', $row ['id'], '">';
  178.         echo '<td><button type="submit" style="border: 1px solid #ff44ff; color: #ee00ff; background-color: #eeccff;">削除</button></td>';
  179.         echo '</form>';
  180.         echo '</tr>';
  181.         echo "\n";
  182.  
  183.     }
  184. }
  185. if(isset($_POST['command']) || !$_POST){
  186.     switch($_POST['command']){
  187.     case 'update':
  188.         $sql = $pdo->prepare('update words set word=?, sense=?, memo=? where id=?');
  189.         $sql -> execute(array(h($_POST['word']),h($_POST['sense']),h($_POST['memo']),$_POST['id']));
  190.         break;
  191.     case 'delete':
  192.         $sql = $pdo->prepare('delete from words where id=?');
  193.         $sql->execute(array($_POST['id']));
  194.         break;
  195.     case 'insert':
  196.         $sql = $pdo->prepare('insert into words values(null,?,?,?)');
  197.         $sql->execute(array(h($_POST['word']),h($_POST['sense']),h($_POST['memo'])));
  198.         break;
  199.     case 'listDisplay':
  200.         break;
  201.     }
  202.         foreach ($pdo->query('select * from words order by id desc') as $row){
  203.         echo '<tr>';
  204. //      echo '<td width="30"  height="35" align="center" width="110" height="35">', h($row['id']), '</td>';
  205.         echo '<td width="30" class="font3"><b>', h($row['word']), '</b></td>';
  206.         echo '<td width="150" class="font3">', h($row['sense']), '</td>';
  207.         echo '<td width="150" class="font3">', h($row['memo']), '</td>';
  208.         echo '</tr>';
  209.         echo "\n";
  210.     }
  211. }
  212. if(isset($_POST['command1'])&&$_POST['command1'] == 'search'){
  213.     $vKeyword = isset($_POST['keyword'])?$_POST['keyword'] : '';
  214.     $sql = $pdo->prepare('select * from words where word like ? or sense like ? or memo like ?');
  215.     $sql->execute(array(
  216.             '%' . $vKeyword . '%',
  217.             '%' . $vKeyword . '%',
  218.             '%' . $vKeyword . '%'
  219.     ) );
  220.     foreach ($sql->fetchAll() as $row){
  221.     echo '<tr>';
  222.     //      echo '<td width="30"  height="35" align="center" width="110" height="35">', h($row['id']), '</td>';
  223.     echo '<td  width="30" class="font3"><b>', h($row['word']), '</b></td>';
  224.     echo '<td width="150" class="font3">', h($row['sense']), '</td>';
  225.     echo '<td width="150" class="font3">', h($row['memo']), '</td>';
  226.     echo '</tr>';
  227.     echo "\n";
  228.     }
  229. }
  230. ?>
  231.  
  232. </table>
  233. </body>
  234. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top