Harigami
ログイン
anonymous タイトルなし
No License Python
コピー
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>mission_3-3</title>
</head>
<body>
   <form action=""method="post">
       <input type="text" name="name" placeholder="名前"><br>
       <input type="text" name="str" placeholder="コメント"><br>
       <input type="submit" name="submit">
      </form>
    <form action=""method="post">
      <input type="text" name="delete_number" placeholder="削除対象番号"><br>
      <input type="submit" name="delete" value="削除">
     </form>
   <?php 
       $name=$_POST["name"];
       $str=$_POST["str"];
       $delete_number=$_POST["delete_number"];
       $filename="mission_3-3.txt";
       if (file_exists($filename)) {$num = count(file($filename))+1;}
       else {$num = 1;}//ファイルの存在があれば+1、なければ1//
       
       if(!empty($str)&&($name)){
       $fp=fopen($filename,"a");
       fwrite($fp,$num."<>");
       fwrite($fp,$name."<>");
       fwrite($fp,$str."<>");
       fwrite($fp,date('Y/m/d h:i:s'.PHP_EOL));
       fclose($fp);
       $contents=file('mission_3-3.txt');
       foreach($contents as $str){
       $lines=explode("<>",$str);
       echo $lines[0]." ".$lines[1]." ".$lines[2]." ".$lines[3]."<br>";
       }
       }
       
       if(!empty($delete_number)){
       $contents=file('mission_3-3.txt');//テキストファイルを行ごとに配列にして返す//
       $fp=fopen($filename,"w");
       fwrite($fp,"");
       fclose($fp);
       foreach($contents as $str){      //配列の要素がある分だけ処理//
       $lines=explode("<>",$str);
       if($lines[0]!=$delete_number){
           $fp=fopen($filename,"a");
           fwrite($fp,$lines);
           fclose($fp);
           echo $lines[0]." ".$lines[1]." ".$lines[2]." ".$lines[3]."<br>";}
       }}
                                    ?>
</body>
</html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>mission_3-3</title>
</head>
<body>
   <form action=""method="post">
       <input type="text" name="name" placeholder="名前"><br>
       <input type="text" name="str" placeholder="コメント"><br>
       <input type="submit" name="submit">
      </form>
    <form action=""method="post">
      <input type="text" name="delete_number" placeholder="削除対象番号"><br>
      <input type="submit" name="delete" value="削除">
     </form>
   <?php 
       $name=$_POST["name"];
       $str=$_POST["str"];
       $delete_number=$_POST["delete_number"];
       $filename="mission_3-3.txt";
       if (file_exists($filename)) {$num = count(file($filename))+1;}
       else {$num = 1;}//ファイルの存在があれば+1、なければ1//
       
       if(!empty($str)&&($name)){
       $fp=fopen($filename,"a");
       fwrite($fp,$num."<>");
       fwrite($fp,$name."<>");
       fwrite($fp,$str."<>");
       fwrite($fp,date('Y/m/d h:i:s'.PHP_EOL));
       fclose($fp);
       $contents=file('mission_3-3.txt');
       foreach($contents as $str){
       $lines=explode("<>",$str);
       echo $lines[0]." ".$lines[1]." ".$lines[2]." ".$lines[3]."<br>";
       }
       }
       
       if(!empty($delete_number)){
       $contents=file('mission_3-3.txt');//テキストファイルを行ごとに配列にして返す//
       $fp=fopen($filename,"w");
       fwrite($fp,"");
       fclose($fp);
       foreach($contents as $str){      //配列の要素がある分だけ処理//
       $lines=explode("<>",$str);
       if($lines[0]!=$delete_number){
           $fp=fopen($filename,"a");
           fwrite($fp,$lines);
           fclose($fp);
           echo $lines[0]." ".$lines[1]." ".$lines[2]." ".$lines[3]."<br>";}
       }}
                                    ?>
</body>
</html>
コンソール
  • anonymous
  • http://creditscorewww.com/ what is a perfect credit score http://creditscorewww.com/ - credit karma canada <a href="http://creditscorewww.com/ ">karma credit score </a>