anonymous No title
PHP
<!DOCTYPE html>
<html>
    
<head>
<meta charset="utf-8" />
<title>Mission_1-20</title>
</head>

<body>
    <form action="" method="post">
        <input type="text" name"str">
        <input type="submit" name="submit">
    </form>
    <?php
            $str = $_POST["str"];
            echo $str;
            $str_a = $_POST["comment"];
            echo $str_a;
    ?>

</body>
</html>
anonymous No title
PHP
  Many thanks quest of making the naturalistic trouble to vindicate this.   https://www.google.rs/url?q=https://professional-heating-and-air-conditioning-repair.com
anonymous No title
PHP
<!DOCTYPE html>
<html>
<head>
<title>kadai_1.php</title>
</head>
<body>

<h1><?php $str_hello="HTML内で";

echo "Hello World";?></h1>
</form>
</body>
</html>
anonymous No title
PHP


<form action = "kadai_1.php" method = "POST" >
<input type="text" name="comment">
<input type="submit" value="送信">
</form>

<?php
echo "あああ";

$file_handle = fopen( "test.txt", "w");
fwrite( $file_handle, "テスト2");
fclose($file_handle);
if (isset($_POST["comment"])) {
    echo $_POST["comment"];
}
?>
anonymous No title
PHP
<?php
session_start();
$dsn = "mysql:dbname=co_19_349_99sv_coco_com;host=localhost;charset=UTF8";
$name_db = "co-19-349.99sv-c";
$password_db = "U2j9s5dQ";

try {
  $mysql = new PDO($dsn,$name_db,$password_db);

} catch (PDOExcption $e){
  echo "エラー" . $e->getMessage() ;
}


if (!empty($_POST["roguinn_submit"])) {

  if (!empty($_POST["roguinn_id"])&&!empty($_POST["roguinn_password"])) {

    if (preg_match("/^[a-zA-Z0-9]+$/",$_POST["roguinn_id"])&&preg_match("/^[a-zA-Z0-9]+$/",$_POST["roguinn_password"])) {

      $roguinn_id = $_POST["roguinn_id"];
      $roguinn_password = $_POST["roguinn_password"];

      $select_sql = "SELECT * FROM kadai_3_1 WHERE id='" . $roguinn_id . "' AND password='" . $roguinn_password . "'";
      $select_sql_query = $mysql->query($select_sql);
      while ($select_sql_query_fetch = $select_sql_query->fetch(PDO::FETCH_ASSOC)) {
              $_SESSION["id"] = $select_sql_query_fetch["id"];
              $_SESSION["password"] = $select_sql_query_fetch["password"];
              $_SESSION["name"] = $select_sql_query_fetch["name"];
              setcookie(name,$_SESSION["name"],1623632328);
        }

      if (!empty($_SESSION["id"])&&!empty($_SESSION["password"])) {

        header('Location: ./kadai_2_ouyou.php');
      }else{
        echo "ID、パスワードが正しくありません";
      }

    }else{
      echo "IDとパスワードは半角英数字で入力してください";
    }
  }else{
    echo "IDとパスワードを両方入力してください";
  }
}

 ?>


<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8">
    <title>ログインページ</title>
  </head>
  <body>
    <h1>ログインページ</h1>
    <p>*IDとパスワードを半角で入力してください</p>
    <br />
    <form action="kadai_2_ouyou.php" method="post">
      ID:<input type="text" name="roguinn_id" value="<?php if(!empty($_SESSION["id"])){echo $_SESSION["id"];} ?>"><br>
      <br />
      パスワード:<input type="text" name="roguinn_password" value="<?php  if(!empty($_SESSION["password"])){echo $_SESSION["password"];} ?>"><br>
      <br />
      <input type="submit" name="roguinn_submit" value="ログイン">
    </form>
  </body>
</html>
anonymous No title
PHP
<h1><?php echo "登録完了";?></h1>

<?php
$dsn = "mysql:dbname=co_19_349_99sv_coco_com;host=localhost;charset=UTF8";
$name_db = "co-19-349.99sv-c";
$password_db = "U2j9s5dQ";
try {
  $mysql = new PDO($dsn,$name_db,$password_db);
} catch (PDOExcption $e){
  echo "エラー" . $e->getMessage() ;
}
$select_sql = "SELECT * FROM kadai_3_1 WHERE id=(select max(id) from kadai_3_1)";
$select_sql_query = $mysql->query($select_sql);
while ($select_sql_query_fetch = $select_sql_query->fetch(PDO::FETCH_ASSOC)) {
  echo "あなたのユーザー情報は" . "<br>" . "ID:{$select_sql_query_fetch["id"]}" . "<br>" . "名前:{$select_sql_query_fetch["name"]}" . "<br>" . "パスワード:{$select_sql_query_fetch["password"]}";
}
 ?>
anonymous No title
PHP
<?php
$dsn = "mysql:dbname=co_19_349_99sv_coco_com;host=localhost;charset=UTF8";
$name_db = "co-19-349.99sv-c";
$password_db = "U2j9s5dQ";
try {
  $mysql = new PDO($dsn,$name_db,$password_db);
} catch (PDOExcption $e){
  echo "エラー" . $e->getMessage() ;
}
if (!empty($_POST["submit"])) {
  if (!empty($_POST["password"])&&!empty($_POST["name"])) {
     if (preg_match("/^[a-zA-Z0-9]+$/",$_POST["password"])) {
        $name = $_POST["name"];
        $password = $_POST["password"];
        $insert_sql = "INSERT INTO kadai_3_1 (name, password) VALUES (?, ?)";
        $insert_sql_prepare = $mysql->prepare($insert_sql);
        $insert_sql_execute = $insert_sql_prepare->execute(array($name, $password));
        header('Location: kadai_3_1_entry.php');
     }else{
       echo "パスワードは半角英数字で入力してください";
     }
  }else{
    echo "パスワードと名前を両方入力してください";
  }
}
?>
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8">
    <title>登録フォーム</title>
  </head>
  <body>
    <h1>新規登録</h1>
    <p>*名前とパスワードを半角で入力してください</p>
    <br />
    <form action="kadai_3_1.php" method="post">
      名前:<input type="text" name="name"><br>
      <br />
      パスワード:<input type="text" name="password"><br>
      <br />
      <input type="submit" name="submit" value="登録">
    </form>
  </body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>簡易掲示板</title>
</head>

<body>

    <h2>入力フォーム</h2>
    <form action="" method="POST">
        <input type="hidden" name="editnumber" size='20' value='' placeholder="名前"><br />
        <input type="text" name="name" size='20' value='' placeholder="名前"><br />
        <input type="text" name="comment" size='20' value='' placeholder="コメント"><br />
        <input type="password" name="password" size='20' value='' placeholder="パスワード"><br />
        <br />
        <input type="submit" name='submit' value='送信' />
    </form>

    <form action="" method="POST">
        <h2>削除フォーム</h2>
        <input type="number" name="deletenumber" size='20' placeholder="削除番号"><br />
        <input type="password" name="deletepassword" placeholder="パスワード"><br />
        <br />
        <input type="submit" name='delete' value='削除' onclick="return confirm('削除しますか?')" />
        <br />
        <br />
    </form>

    <form action="" method="POST">
        <h2>編集フォーム</h2>
        <input type="text" name="editnumber" placeholder="編集番号"><br />
        <input type="password" name="editpassword" placeholder="パスワード"><br />
        <br />
        <input type="submit" name="edit" value="編集"><br />
        <br />
        <br />
    </form>


    <?php
    // データベースへ接続
    try {
        $dsn = 'mysql:dbname=co_19_349_99sv_coco_com;host=localhost';
        $user = 'co-19-349.99sv-c';
        $password = 'U2j9s5dQ';
        $pdo = new PDO($dsn, $user, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
    } catch (PDOException $e) {
        echo 'DB接続エラー' . $e->getMessage;
    }


    // リセット用
    // $sql = "DROP TABLE kadai2a";
    // $pdo->query($sql);


    // テーブルを作成
    $sql = "CREATE TABLE IF NOT EXISTS kadai2a"
        . "("
        . "id INT AUTO_INCREMENT PRIMARY KEY,"
        . "name char(32),"
        . "comment TEXT,"
        . "date DATETIME,"
        . "password TEXT"
        . ");";
    $stmt = $pdo->query($sql);


    // 新規投稿
    if (isset($_POST['submit'])) {
        if (isset($_POST['name']) && (isset($_POST['comment'])) && (isset($_POST['password']))) {
            $sql = $pdo->prepare("INSERT INTO kadai2a (name,comment,date,password) VALUES (:name,:comment,:date,:password)");
            $sql->bindParam(':name', $name, PDO::PARAM_STR);
            $sql->bindParam(':comment', $comment, PDO::PARAM_STR);
            $sql->bindParam(':date', $date, PDO::PARAM_STR);
            $sql->bindParam(':password', $password, PDO::PARAM_STR);
            $name = $_POST['name'];
            $comment = $_POST['comment'];
            date_default_timezone_set('Asia/Tokyo');
            $date = date("Y/m/d H:i:s");
            $password = $_POST['password'];
            $sql->execute();
        }
        if ((empty($name)) || (empty($comment)) || (empty($password))) {
            echo "<script>alert('未入力項目があります')</script>";
        }
    }

    // 編集
    if (isset($_POST['edit'])) {
        if ((isset($_POST['editnumber'])) && (isset($_POST['editpassword']))) {
            $editnumber = $_POST['editnumber'];
            $editpassword = $_POST['editpassword'];
            $results = $pdo->query("SELECT * FROM kadai2a WHERE id= $editnumber");
            foreach ($results as $result) {
                if ($editnumber == $result['id'] && $editpassword == $result['password']) {
                    $editnumber = $result['id'];
                    $editname = $result['name'];
                    $editcomment = $result['comment'];
                    $editpassword = $result['password'];
                    echo "編集番号" . $editnumber
    ?>
                    <form action="<?php echo ($_SERVER['PHP_SELF']) ?>" method="POST">
                        <input type="hidden" name="editnumber" value="<?php if (isset($editnumber)) {
                                                                            echo $editnumber;
                                                                        } ?>">
                        <h3>名前:</h3>
                        <input type="text" name="editname" value="<?php if (isset($editname)) {
                                                                        echo $editname;
                                                                    } ?>">
                        <h3>コメント:</h3>
                        <input type="text" name="editcomment" value="<?php if (isset($editcomment)) {
                                                                            echo $editcomment;
                                                                        } ?>">
                        <h3>パスワード:</h3>
                        <input type="password" name="editpassword" value="<?php if (isset($editpassword)) {
                                                                                echo $editpassword;
                                                                            } ?>"><br />
                                                                            <br />
                        <input type="submit" name="editsubmit" value="編集"><br /><br /><br />
                    </form>
    <?php
                    break;
                } elseif ($editnumber == $result['id'] && $editpassword != $result['password']) {
                    echo "<script>alert('パスワードが違います')</script>";
                }
            }
        }
    }
    if (isset($_POST['editsubmit'])) {
        if (!empty($_POST["editname"]) && (!empty($_POST["editcomment"])) && (!empty($_POST["editpassword"]))) {
            try {
                $dsn = 'mysql:dbname=co_19_349_99sv_coco_com;host=localhost';
                $user = 'co-19-349.99sv-c';
                $password = 'U2j9s5dQ';
                $pdo = new PDO($dsn, $user, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
                $editnumber = $_POST['editnumber'];
                $name = $_POST['editname'];
                $comment = $_POST['editcomment'];
                date_default_timezone_set('Asia/Tokyo');
                $date = date("Y/m/d H:i:s");
                $password = $_POST['editpassword'];
                $sql = "UPDATE kadai2a SET name=:name,comment=:comment,date=:date,password=:password WHERE id=$editnumber";
                $stmt = $pdo->prepare($sql);
                $stmt->execute(array(':name' => $name, ':comment' => $comment, ':date' => $date, ':password' => $password));
            } catch (PDOException $e) {
                echo 'DB接続エラー' . $e->getMessage;
            }
        }
    }


    // 削除
    if (isset($_POST['delete'])) {
        if ((isset($_POST['delete'])) && (isset($_POST['deletepassword']))) {
            $deletenumber = $_POST['deletenumber'];
            $deletepassword = $_POST['deletepassword'];
            $res = $pdo->query('SELECT * FROM kadai2a');
            foreach ($res as $value) {
                if ($deletenumber == $value['id'] && $deletepassword == $value['password']) {
                    $id = $deletenumber;
                    $sql = 'delete from kadai2a where id=:id';
                    $stmt = $pdo->prepare($sql);
                    $stmt->bindParam(':id', $id, PDO::PARAM_INT);
                    $stmt->execute();
                } elseif ($deletenumber == $value['id'] && $deletepassword != $value['password']) {
                    echo "<script>alert('パスワードが違います')</script>";
                }
            }
        }
    }




    // データを表示する
    $sql = 'SELECT * FROM kadai2a';
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $results = $stmt->fetchAll();
    foreach ($results as $row) {
        echo $row['id'] . ',';
        echo $row['name'] . ',';
        echo $row['comment'] . ',';
        echo $row['date'] . '<br>';
        echo "<hr>";
    }
    ?>

</body>

</html>
anonymous No title
PHP
<?php
 echo "Hello World";
?>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja" >
  <head>
    <meta charset="utf-8">
    <title>簡易掲示板</title>
  </head>

  <body>
    <h1>簡易掲示板</h1>
    <form action="" method="post">
      
      <p>名前</p>
      <input type="text" name="user_name"><br>
      
      <p>コメント</p>
      <textarea name="comment" rows="4" cols="40"></textarea><br>
     
      <input type="submit" value="送信">
    </form>
<?php

error_reporting(0);
  
    $name=$_POST["user_name"];
   
   $comment=$_POST["comment"];
   
   $date=date("Y-m-d H:i:s");
  
   $filename="kadai_2_3(3).txt";
   
   $num=count(file($filename))+1;
   
   $parts="$num<>$name<>$comment<>$date";
  
   $fp=fopen($filename,"a");

    if(empty($name) && empty($comment)){
       echo "未記入箇所があります。<br>";
   }
  
   elseif(empty($name) ){
       echo "名前を入力してください<br>";
   }
  
   elseif(empty($comment)){
       echo "コメントを入力してください<br>";
   }
   
   elseif(isset($name) && isset($comment)){
     fwrite($fp,"$parts".PHP_EOL);
     fclose($fp);
   }
  
   if(file_exists($filename)){
     
     $lines=file($filename,FILE_IGNORE_NEW_LINES);
     foreach($lines as $line){
      
       list($num,$name,$comment,$date)=explode("<>",$line);
      
       echo "$num<>$name<>$comment<>$date"."<br>";
     }
   }
?>
  </body>
</html>
Don't you submit code?
Submit