Share Code Quickly

What is Harigami?

Harigami is a simple source code sharing service. You can share source code by an URL which is issued after submission.
You can also run your source code online such as Python, Ruby, JavaScript and so on.
For free.Use for code review.
Preferences
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>課題2-応用</title>
</head>
<body>
<?php
// データベース接続
$dsn = 'mysql:dbname=co_19_266_99sv_coco_com;host=localhost';
$user = 'co-19-266.99sv-c';
$password = 'Lk6BjZYu';
try {

  $dbh = new PDO($dsn, $user, $password, [PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION] );

  //データベースに接続できなかった時
  } catch (PDOException $e) {

    echo "接続失敗: " . $e->getMessage() . "\n";
    exit();
  }

    //テーブル作成
    $stmt = $dbh->query("CREATE TABLE IF NOT EXISTS posts (
      id INT AUTO_INCREMENT PRIMARY KEY,
      name TEXT,
      comment TEXT,
      postDate TEXT,
      new_pass TEXT
      )"
    );

    // 新規投稿
    if($_SERVER["REQUEST_METHOD"] === 'POST') {
      if(isset($_POST["send"]) && isset($_POST["name"]) && isset($_POST["comment"]) && isset($_POST["new_pass"]) && empty($_POST["hidden_editNo"])) {
        if(!empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          $name = trim($_POST["name"]);
          $comment = trim($_POST["comment"]);
          $send = $_POST["send"];
          $new_pass = trim($_POST["new_pass"]);
          $postDate = date('Y-m-d H:i:s');
          if(empty($name)) { 
            $name = "名無し";
          }
          $stmt = $dbh->prepare("INSERT INTO posts (name,comment,postDate,new_pass) VALUES (:name,:comment,:postDate,:new_pass)");
          $params = array(':name'=>$name,':comment'=>$comment,':postDate'=> $postDate,':new_pass'=> $new_pass);
          $stmt->execute($params);
          header('Location:http://co-19-266.99sv-coco.com/kadai_2-apply.php');
          exit;
        } elseif(empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          echo "<script>alert('コメントが入力されていません。');</script>";
        } elseif(empty($_POST["new_pass"]) && !empty($_POST["comment"]) && isset($_POST["send"])) {
          echo "<script>alert('パスワードが入力されていません。');</script>";
        }elseif(isset($_POST["send"]) && empty($_POST["comment"]) && empty($_POST["new_pass"])) {
          echo "<script>alert('パスワードとコメントが入力されていません。');</script>";
        }
      }
    }

// 編集
if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["edit"]) && isset($_POST["editNo"]) && isset($_POST["edit_pass"])) {
    if(!empty($_POST["editNo"]) && !empty($_POST["edit_pass"])) {
      $edit = $_POST["edit"];
      $editNo = $_POST["editNo"];
      $edit_pass = $_POST["edit_pass"];
      $res = $dbh->query('SELECT * FROM posts');
      foreach( $res as $value ){
        if($editNo == $value['id'] && $edit_pass == $value['new_pass']) {
          $hidden_editNo = $value['id'];
          $edit_name = $value['name'];
          $edit_comment = $value['comment'];
          $edit_ID = $value['new_pass'];
        } elseif ($editNo == $value['id'] && $edit_pass != $value['new_pass']) {
          echo "<script>alert('パスワードが間違っています。');</script>";
        }
    }
   } elseif (empty($_POST["editNo"]) && isset($_POST["edit"]) && !empty($_POST["edit_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
   } elseif (empty($_POST["edit_pass"]) && isset($_POST["edit"]) && !empty($_POST["editNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
   }
  } 
}

//編集する値がフォームに表示された後の投稿
if(!empty($_POST["name"]) && !empty($_POST["comment"]) && !empty($_POST["hidden_editNo"])) {
  $name = $_POST["name"];
  $comment = $_POST["comment"];
  $hidden_editNo = $_POST["hidden_editNo"];
  $postDate = date('Y-m-d H:i:s');
  $new_pass = $_POST["new_pass"];
  $res = $dbh->query('SELECT * FROM posts');
  $stmt = $dbh->prepare("UPDATE posts SET name = :name,comment = :comment,postDate =:postDate, new_pass = :new_pass WHERE id = $hidden_editNo");
  $params = array(':name' => $name,':comment'=>$comment,':postDate'=>$postDate,':new_pass'=>$new_pass);
  $stmt->execute($params);
}

// 削除
if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["delete"]) && isset($_POST["deleteNo"]) && isset($_POST["delete_pass"])) {
    if(!empty($_POST["deleteNo"]) && !empty($_POST["delete_pass"])) {
      $delete = $_POST["delete"];
      $deleteNo = $_POST["deleteNo"];
      $delete_pass = $_POST["delete_pass"];
      $res = $dbh->query('SELECT * FROM posts');
      foreach( $res as $value ){
        if($deleteNo == $value['id'] && $delete_pass == $value['new_pass']) {
          $stmt = $dbh->prepare("DELETE FROM posts WHERE id =:id");
          $params = array(':id'=> $deleteNo);
          $stmt->execute($params);
          $sql = "ALTER TABLE posts DROP column id";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts add id int(11) primary key not null auto_increment first";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts AUTO_INCREMENT = 1"; 
          $stmt = $dbh->query($sql);

          header('Location:http://co-19-266.99sv-coco.com/kadai_2-apply.php');
          exit;
        } else if($deleteNo == $value['id'] && $delete_pass != $value['new_pass']) {
            echo "<script>alert('パスワードが間違っています。');</script>";
        }
      }
    } elseif(empty($_POST["deleteNo"]) && isset($_POST["delete"]) && !empty($_POST["delete_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
    } elseif(empty($_POST["delete_pass"]) && isset($_POST["delete"]) && !empty($_POST["deleteNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
    }
  }
}
?>

<!-- html記述 -->
  <h1>簡易掲示板</h1>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿フォーム -->
  <form action = "" method = "post">
  <!-- 編集モード用 のinput-->
  <input type = "hidden" name = "hidden_editNo" value = "<?php if(isset($hidden_editNo)) {echo $hidden_editNo;}?>">
  <p>名前:
    <input type = "text" name = "name" value = "<?php if(isset($edit_name)) {echo $edit_name;}?>">
  </p>
  <p>コメント:
    <textarea name = "comment"><?php if(isset($edit_comment)) {echo $edit_comment;}?></textarea>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "new_pass" value="<?php if(isset($edit_ID)) {echo $edit_ID;}?>">
  </p>
  <input type = "submit" name = "send" value = "投稿">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 編集フォーム -->
  <form action = "" method = "post">
  <p>編集したい番号を入力してください:
    <select name= "editNo">  
      <option value="未選択">選択してください</option>
      <?php 
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
        for ($i = 1; $i <= $cnt; $i++) {
          echo "<option value = '{$i}'>{$i}</option>";
        }
        if(empty($cnt)) {
          echo "<option disabled value = '{$i}'></option>";
        }
      ?>
    </select>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "edit_pass">
  </p>
  <input type = "submit" name = "edit" value = "編集">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 削除フォーム -->
  <form action = "" method = "post" onSubmit="return check()">
  <p>削除したい番号を入力してください:
    <select name= "deleteNo">  
      <option value="未選択">選択してください</option>
      <?php 
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
        for ($i = 1; $i <= $cnt; $i++) {
          echo "<option value = '{$i}'>{$i}</option>";
        }
        if(empty($cnt)) {
          echo "<option disabled value = '{$i}'></option>";
        }
      ?>
    </select>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "delete_pass">
  </p>
  <!-- 削除確認ダイアログ -->
  <script type="text/javascript">
    function check(){
      if(window.confirm('本当に削除しますか?')){
       return true;
     }else{
       window.alert('キャンセルされました');
       return false;
     }
   }
  </script>
  <input type = "submit" name = "delete" value = "削除" >
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿一覧表示 -->
  <h2>投稿一覧(
    <?php
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
    ?>
    件)</h2>
  <?php
   $sql = 'SELECT * FROM posts';
   $stmt = $dbh->query($sql);
   $stmt-> execute();
     $res = $dbh-> query('SELECT * FROM posts');
       foreach($res as $value) {
         echo $value['id']."\t";
         echo $value['name']."\t";
         echo $value['comment']."\t";
         echo $value['postDate'];
         echo "<br>";
         echo "<p>---------------------------------------------------------------</p>";
       }
  
  ?>
  <p>-------------------------------------------------------------------------------</p>
</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>課題2-応用</title>
</head>
<body>
<?php
// データベース接続
$dsn = 'mysql:dbname=*******;host=localhost';
$user = '********';
$password ='*******';
try {

  $dbh = new PDO($dsn, $user, $password, [PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION] );

  //データベースに接続できなかった時
  } catch (PDOException $e) {

    echo "接続失敗: " . $e->getMessage() . "\n";
    exit();
  }

    //テーブル作成
    $stmt = $dbh->query("CREATE TABLE IF NOT EXISTS posts (
      id INT AUTO_INCREMENT PRIMARY KEY,
      name TEXT,
      comment TEXT,
      postDate TEXT,
      new_pass TEXT
      )"
    );

    // 新規投稿
    if($_SERVER["REQUEST_METHOD"] === 'POST') {
      if(isset($_POST["send"]) && isset($_POST["name"]) && isset($_POST["comment"]) && isset($_POST["new_pass"]) && empty($_POST["hidden_editNo"])) {
        if(!empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          $name = trim($_POST["name"]);
          $comment = trim($_POST["comment"]);
          $send = $_POST["send"];
          $new_pass = trim($_POST["new_pass"]);
          $postDate = date('Y-m-d H:i:s');
          if(empty($name)) { 
            $name = "名無し";
          }
          $stmt = $dbh->prepare("INSERT INTO posts (name,comment,postDate,new_pass) VALUES (:name,:comment,:postDate,:new_pass)");
          $params = array(':name'=>$name,':comment'=>$comment,':postDate'=> $postDate,':new_pass'=> $new_pass);
          $stmt->execute($params);
          header('Location:http://co-19-266.99sv-coco.com/kadai_2-apply.php');
          exit;
        } elseif(empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          echo "<script>alert('コメントが入力されていません。');</script>";
        } elseif(empty($_POST["new_pass"]) && !empty($_POST["comment"]) && isset($_POST["send"])) {
          echo "<script>alert('パスワードが入力されていません。');</script>";
        }elseif(isset($_POST["send"]) && empty($_POST["comment"]) && empty($_POST["new_pass"])) {
          echo "<script>alert('パスワードとコメントが入力されていません。');</script>";
        }
      }
    }

// 編集
if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["edit"]) && isset($_POST["editNo"]) && isset($_POST["edit_pass"])) {
    if(!empty($_POST["editNo"]) && !empty($_POST["edit_pass"])) {
      $edit = $_POST["edit"];
      $editNo = $_POST["editNo"];
      $edit_pass = $_POST["edit_pass"];
      $res = $dbh->query('SELECT * FROM posts');
      foreach( $res as $value ){
        if($editNo == $value['id'] && $edit_pass == $value['new_pass']) {
          $hidden_editNo = $value['id'];
          $edit_name = $value['name'];
          $edit_comment = $value['comment'];
          $edit_ID = $value['new_pass'];
        } elseif ($editNo == $value['id'] && $edit_pass != $value['new_pass']) {
          echo "<script>alert('パスワードが間違っています。');</script>";
        }
    }
   } elseif (empty($_POST["editNo"]) && isset($_POST["edit"]) && !empty($_POST["edit_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
   } elseif (empty($_POST["edit_pass"]) && isset($_POST["edit"]) && !empty($_POST["editNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
   }
  } 
}

//編集する値がフォームに表示された後の投稿
if(!empty($_POST["name"]) && !empty($_POST["comment"]) && !empty($_POST["hidden_editNo"])) {
  $name = $_POST["name"];
  $comment = $_POST["comment"];
  $hidden_editNo = $_POST["hidden_editNo"];
  $postDate = date('Y-m-d H:i:s');
  $new_pass = $_POST["new_pass"];
  $res = $dbh->query('SELECT * FROM posts');
  $stmt = $dbh->prepare("UPDATE posts SET name = :name,comment = :comment,postDate =:postDate, new_pass = :new_pass WHERE id = $hidden_editNo");
  $params = array(':name' => $name,':comment'=>$comment,':postDate'=>$postDate,':new_pass'=>$new_pass);
  $stmt->execute($params);
}

// 削除
if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["delete"]) && isset($_POST["deleteNo"]) && isset($_POST["delete_pass"])) {
    if(!empty($_POST["deleteNo"]) && !empty($_POST["delete_pass"])) {
      $delete = $_POST["delete"];
      $deleteNo = $_POST["deleteNo"];
      $delete_pass = $_POST["delete_pass"];
      $res = $dbh->query('SELECT * FROM posts');
      foreach( $res as $value ){
        if($deleteNo == $value['id'] && $delete_pass == $value['new_pass']) {
          $stmt = $dbh->prepare("DELETE FROM posts WHERE id =:id");
          $params = array(':id'=> $deleteNo);
          $stmt->execute($params);
          $sql = "ALTER TABLE posts DROP column id";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts add id int(11) primary key not null auto_increment first";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts AUTO_INCREMENT = 1"; 
          $stmt = $dbh->query($sql);

          header('Location:http://co-19-266.99sv-coco.com/kadai_2-apply.php');
          exit;
        } else if($deleteNo == $value['id'] && $delete_pass != $value['new_pass']) {
            echo "<script>alert('パスワードが間違っています。');</script>";
        }
      }
    } elseif(empty($_POST["deleteNo"]) && isset($_POST["delete"]) && !empty($_POST["delete_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
    } elseif(empty($_POST["delete_pass"]) && isset($_POST["delete"]) && !empty($_POST["deleteNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
    }
  }
}
?>

<!-- html記述 -->
  <h1>簡易掲示板</h1>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿フォーム -->
  <form action = "" method = "post">
  <!-- 編集モード用 のinput-->
  <input type = "hidden" name = "hidden_editNo" value = "<?php if(isset($hidden_editNo)) {echo $hidden_editNo;}?>">
  <p>名前:
    <input type = "text" name = "name" value = "<?php if(isset($edit_name)) {echo $edit_name;}?>">
  </p>
  <p>コメント:
    <textarea name = "comment"><?php if(isset($edit_comment)) {echo $edit_comment;}?></textarea>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "new_pass" value="<?php if(isset($edit_ID)) {echo $edit_ID;}?>">
  </p>
  <input type = "submit" name = "send" value = "投稿">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 編集フォーム -->
  <form action = "" method = "post">
  <p>編集したい番号を入力してください:
    <select name= "editNo">  
      <option value="未選択">選択してください</option>
      <?php 
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
        for ($i = 1; $i <= $cnt; $i++) {
          echo "<option value = '{$i}'>{$i}</option>";
        }
        if(empty($cnt)) {
          echo "<option value = '{$i}'> ' ' </option>";
        }
      ?>
    </select>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "edit_pass">
  </p>
  <input type = "submit" name = "edit" value = "編集">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 削除フォーム -->
  <form action = "" method = "post" onSubmit="return check()">
  <p>削除したい番号を入力してください:
    <select name= "deleteNo">  
      <option value="未選択">選択してください</option>
      <?php 
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
        for ($i = 1; $i <= $cnt; $i++) {
          echo "<option value = '{$i}'>{$i}</option>";
        }
        if(empty($cnt)) {
          echo "<option value = '{$i}'> ' ' </option>";
        }
      ?>
    </select>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "delete_pass">
  </p>
  <!-- 削除確認ダイアログ -->
  <script type="text/javascript">
    function check(){
      if(window.confirm('本当に削除しますか?')){
       return true;
     }else{
       window.alert('キャンセルされました');
       return false;
     }
   }
  </script>
  <input type = "submit" name = "delete" value = "削除" >
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿一覧表示 -->
  <h2>投稿一覧(
    <?php
      $sql = 'SELECT * FROM posts';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
    ?>
    件)</h2>
  <?php
   $sql = 'SELECT * FROM posts';
   $stmt = $dbh->query($sql);
   $stmt-> execute();
     $res = $dbh-> query('SELECT * FROM posts');
       foreach($res as $value) {
         echo $value['id']."\t";
         echo $value['name']."\t";
         echo $value['comment']."\t";
         echo $value['postDate'];
         echo "<br>";
         echo "<p>---------------------------------------------------------------</p>";
       }
  
  ?>
  <p>-------------------------------------------------------------------------------</p>
</body>
</html>
anonymous No title
C#
 //プレイヤーが跳ねる雲
    void OnCollisionStay2D(Collision2D other)
    {
         elapsedTime += Time.deltaTime;

         if (Input.GetKeyDown(KeyCode.Space))
         {
            jump = true;
         }

        if (other.collider.gameObject.tag == "Tranp")
        {

            if (elapsedTime >= untilJump)
            {
                if (jump)
                {
                    this.rigid2D.AddForce(transform.up * this.jumpForce * 1.2f);
                    elapsedTime = 0;
                    jump = false;
                }
                else
                {
                    this.rigid2D.AddForce(transform.up * this.jumpForce * 0.3f);
                }

            }

        }
    }

        void OnCollisionExit2D(Collision2D other)
        {
            elapsedTime = 0;
            jump = false;
        }
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>課題2-応用</title>
</head>
<body>
<?php
// データベース接続
$dsn = 'mysql:dbname=*********;host=localhost';
$user = '**********';
$password = '********';
try {

  $dbh = new PDO($dsn, $user, $password, [PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION] );

  //データベースに接続できなかった時
  } catch (PDOException $e) {

    echo "接続失敗: " . $e->getMessage() . "\n";
    exit();
  }

    //テーブル作成
    $stmt = $dbh->query("CREATE TABLE IF NOT EXISTS posts2 (
      id INT AUTO_INCREMENT PRIMARY KEY,
      name TEXT,
      comment TEXT,
      postDate TEXT,
      new_pass TEXT
      )"
    );

    // 新規投稿
    // if($_SERVER["REQUEST_METHOD"] === 'POST') {
      if(isset($_POST["send"]) && isset($_POST["name"]) && isset($_POST["comment"]) && isset($_POST["new_pass"]) && empty($_POST["hidden_editNo"])) {
        if(!empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          $name = trim($_POST["name"]);
          $comment = trim($_POST["comment"]);
          $send = $_POST["send"];
          $new_pass = trim($_POST["new_pass"]);
          $postDate = date('Y-m-d H:i:s');
          if(empty($name)) { 
            $name = "名無し";
          }
          $stmt = $dbh->prepare("INSERT INTO posts2 (name,comment,postDate,new_pass) VALUES (:name,:comment,:postDate,:new_pass)");
          $params = array(':name'=>$name,':comment'=>$comment,':postDate'=> $postDate,':new_pass'=> $new_pass);
          $stmt->execute($params);
        } elseif(empty($_POST["comment"]) && !empty($_POST["new_pass"]) && isset($_POST["send"])) {
          echo "<script>alert('コメントが入力されていません。');</script>";
        } elseif(empty($_POST["new_pass"]) && !empty($_POST["comment"]) && isset($_POST["send"])) {
          echo "<script>alert('パスワードが入力されていません。');</script>";
        }elseif(isset($_POST["send"]) && empty($_POST["comment"]) && empty($_POST["new_pass"])) {
          echo "<script>alert('パスワードとコメントが入力されていません。');</script>";
        }
      }
    // }

// 編集
// if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["edit"]) && isset($_POST["editNo"]) && isset($_POST["edit_pass"])) {
    if(!empty($_POST["editNo"]) && !empty($_POST["edit_pass"])) {
      $edit = $_POST["edit"];
      $editNo = $_POST["editNo"];
      $edit_pass = $_POST["edit_pass"];
      $res = $dbh->query('SELECT * FROM posts2');
      foreach( $res as $value ){
        if($editNo == $value['id'] && $edit_pass == $value['new_pass']) {
          $hidden_editNo = $value['id'];
          $edit_name = $value['name'];
          $edit_comment = $value['comment'];
          $edit_ID = $value['new_pass'];

        } elseif ($editNo == $value['id'] && $edit_pass != $value['new_pass']) {
          echo "<script>alert('パスワードが間違っています。');</script>";
        }
      break;
    }
   } elseif (empty($_POST["editNo"]) && isset($_POST["edit"]) && !empty($_POST["edit_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
   } elseif (empty($_POST["edit_pass"]) && isset($_POST["edit"]) && !empty($_POST["editNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
   }
  } 
// }

//編集する値がフォームに表示された後の投稿
if(!empty($_POST["name"]) && !empty($_POST["comment"]) && !empty($_POST["hidden_editNo"])) {
  $name = $_POST["name"];
  $comment = $_POST["comment"];
  $hidden_editNo = $_POST["hidden_editNo"];
  $postDate = date('Y-m-d H:i:s');
  $new_pass = $_POST["new_pass"];
  $res = $dbh->query('SELECT * FROM posts2');
  $stmt = $dbh->prepare("UPDATE posts2 SET name = :name,comment = :comment,postDate =:postDate, new_pass = :new_pass WHERE id = $hidden_editNo");
  $params = array(':name' => $name,':comment'=>$comment,':postDate'=>$postDate,':new_pass'=>$new_pass);
  $stmt->execute($params);
}

// 削除
// if($_SERVER["REQUEST_METHOD"] === 'POST') {
  if(isset($_POST["delete"]) && isset($_POST["deleteNo"]) && isset($_POST["delete_pass"])) {
    if(!empty($_POST["deleteNo"]) && !empty($_POST["delete_pass"])) {
      $delete = $_POST["delete"];
      $deleteNo = $_POST["deleteNo"];
      $delete_pass = $_POST["delete_pass"];
      $res = $dbh->query('SELECT * FROM posts2');
      foreach( $res as $value ){
        if($deleteNo == $value['id'] && $delete_pass == $value['new_pass']) {
          $stmt = $dbh->prepare("DELETE FROM posts2 WHERE id =:id");
          $params = array(':id'=> $deleteNo);
          $stmt->execute($params);
          $sql = "ALTER TABLE posts2 DROP column id";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts2 add id int(11) primary key not null auto_increment first";
          $stmt = $dbh->query($sql);
          $sql = "ALTER TABLE posts2 AUTO_INCREMENT = 1"; 
          $stmt = $dbh->query($sql);
        } else if($deleteNo == $value['id'] && $delete_pass != $value['new_pass']) {
            echo "<script>alert('パスワードが間違っています。');</script>";
        }
       break;
      }
    } elseif(empty($_POST["deleteNo"]) && isset($_POST["delete"]) && !empty($_POST["delete_pass"])) {
        echo "<script>alert('番号を入力してください。');</script>";
    } elseif(empty($_POST["delete_pass"]) && isset($_POST["delete"]) && !empty($_POST["deleteNo"])) {
        echo "<script>alert('パスワードを入力してください。');</script>";
    }
  }
// }
?>

<!-- html記述 -->
  <h1>簡易掲示板</h1>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿フォーム -->
  <form action = "" method = "post">
  <!-- 編集モード用 のinput-->
  <input type = "hidden" name = "hidden_editNo" value = "<?php if(isset($hidden_editNo)) {echo $hidden_editNo;}?>">
  <p>名前:
    <input type = "text" name = "name" value = "<?php if(isset($edit_name)) {echo $edit_name;}?>">
  </p>
  <p>コメント:
    <textarea name = "comment"><?php if(isset($edit_comment)) {echo $edit_comment;}?></textarea>
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "new_pass" value="<?php if(isset($edit_ID)) {echo $edit_ID;}?>">
  </p>
  <input type = "submit" name = "send" value = "投稿">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 編集フォーム -->
  <form action = "" method = "post">
  <p>編集したい番号を入力してください:
    <input type = "text" name = "editNo">
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "edit_pass">
  </p>
  <input type = "submit" name = "edit" value = "編集">
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 削除フォーム -->
  <form action = "" method = "post" onSubmit="return check()">
  <p>削除したい番号を入力してください:
    <input type = "text" name = "deleteNo">
  </p>
  <p>パスワードを入力してください:
    <input type = "password" name = "delete_pass">
  </p>
  <!-- 削除確認ダイアログ -->
  <script type="text/javascript">
    function check(){
      if(window.confirm('本当に削除しますか?')){
       return true;
     }else{
       window.alert('キャンセルされました');
       return false;
     }
   }
  </script>
  <input type = "submit" name = "delete" value = "削除" >
  </form>
  <p>-------------------------------------------------------------------------------</p>
  <!-- 投稿一覧表示 -->
  <h2>投稿一覧(
    <?php
      $sql = 'SELECT * FROM posts2';
      $stmt = $dbh->query($sql);
      $stmt-> execute();
      $cnt = $stmt->rowCount();
      echo $cnt;
    ?>
    件)</h2>
  <?php
   $sql = 'SELECT * FROM posts2';
   $stmt = $dbh->query($sql);
   $stmt-> execute();
     $res = $dbh-> query('SELECT * FROM posts2');
       foreach($res as $value) {
         echo $value['id']."\t";
         echo $value['name']."\t";
         echo $value['comment']."\t";
         echo $value['postDate'];
         var_dump($value['new_pass']);
         echo "<br>";
         echo "<p>---------------------------------------------------------------</p>";
       }
  
  ?>
  <p>-------------------------------------------------------------------------------</p>
</body>
</html>
NinoX No title
Python
import notification
import clipboard
import keyboard
import datetime
import calendar
import tweepy
import base64
import json
import time
import glob
import os
import sys
import re
import random
import console
import sound


"""
              ---初期設定---
   
 ①本体コードの貼り付けができたら、30行目の@の後にTwitterIDを入れてください。
 次に右上にある再生マーク ▷ を押して下さい
 
 ② 表示された数字と入力したTwitterIDを DMで伝えて下さい
 
 ③それと引き換えにこちらがIDを渡しますので、受け取ったAutoIDを32行目 00000 を消して貼り付けてください

"""

#    00000 を消した後 貰ったIDを = の後にそのまま貼り付けてください
Auto_ID = "0010"

"""

   ---使用設定部分---
  
   パスツイ  21:30
   ルーム番号 567
   
      の場合
     ↓↓↓↓↓↓↓↓
     
 pass_tweet_time = "30"      ← 21:00 の場合は"00"  ※分だけを記入します。
 room_id         = "567" 

----- このように下を書き換えます。------
 
"""

pass_tweet_time = "33"
room_id         = "3299" 


"""
     ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
     ⚠️以下書き換えると動作しなくなります
   ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
"""

flag     = 0
flag_S   = 0
password = ""

CK =  b'dE5yUHNVbWE2a2YyclJ1M2FBMmhtcmFPdQ=='
CKS = b'NEtTYTJYbWNQMEdTV1Z6d21DQUgwV3lHTURLVXNVaHFIWmFpM3RVY2hTU1g2cXdYeEs='
AT = "1323933402144202752-LpHTamJEW98BSlj7Mj9pF44my9I0D7"
ATS = "1jSIOsLxLMc0F6ruO2bYkZ726ijVax3egz0DpGv9hPpyk"

basenumber = "0123456789"

font_item = ["⓪①②③④⑤⑥⑦⑧⑨",
             "⓿❶❷❸❹❺❻❼❽❾",
             "0123456789",
             "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡",]
            
itemlist1 = ["@[a-zA-Z0-9_]+",
             "[0-9]{1,2}:[0-5][0-9]",
             "[0-9]{1,2}時[0-59]分",
             "([0-9]|[0-2][0-9])時",
             "[0-5][0-9]分",
             "[1-9]{1,2}/[0-9]{1,2}",
             "[0-9]{1,2}月([1-3][0-9]|[0-9])日",]
             
             
itemlist2 = [" "," ",]

message  = {
	"no_update":"パスツイ取得中",
	"code_notification":"この数字をDMで伝えてください:",
	"copy_error":"Twitterリンクのコピー又はフルアクセスの許可をしてください",
	"pass_notfound":"パスワードが取得できませんでした",
	"waiting_passtweet":"からのパスツイ待機中...",
	"stop":"動作可能時間内にパスツイが見つかりませんでした。",
	"success":b'SUToqo3oqLzmiJDlip8=',
	"fail":b'SUToqo3oqLzlpLHmlZc=',
	"repush":"パスツイ予定時間の数秒前にもう一度ボタンを押して下さい",
}


"""
  関数
"""


	
def login(CK,CKS,AT,ATS):
	CK = base64.b64decode(CK.decode())
	CKS = base64.b64decode(CKS.decode())
	auth = tweepy.OAuthHandler(str(CK).split("'")[1],str(CKS).split("'")[1])
	auth.set_access_token(AT,ATS)
	API = tweepy.API(auth)
	return API
	
def exit():
	sys.exit()
	
def get_username():
	user_name = clipboard.get()
	if("https" in user_name):
		user_name = user_name.split("/")
		user_name = user_name[3].split("?")
		user_name = user_name[0]
		return user_name
	else:
		print(message["copy_error"])
		sys.exit()

def ACencrtrpt(a):
	c = str(a)
	c = base64.b64encode(c.encode())
	return c
	
def Test(c,d):
	if c == d:
		return True
	else:
		key = glob.glob("*.pwd")
		key = key[0].split(".")[0]
		print(message["code_notification"]+key)
		sys.exit()
		
def check():
	file = glob.glob("*.pwd")
	i = 0
	if not file:
		key = int(random.uniform(1,99))*int(random.uniform(99,999))*int(random.uniform(1,9))
		key = str(key)
		with open(key+".pwd" , mode="w") as f:
			f.write("")
		notification.schedule(message["code_notification"]+key)
		print(message["code_notification"]+key)
		sys.exit()
	else:
		code = file[0].split(".")[0]
		return code,i
							
def tweet_filter(Tweettext):
	for i in range(10):
		if(font_item[0][i] in Tweettext):
			Tweettext = Tweettext.replace(font_item[0][i],basenumber[i])
		for j in range(10):
			if(font_item[1][j] in Tweettext):
				Tweettext = Tweettext.replace(font_item[1][j],basenumber[j])
			for k in range(10):
				if(font_item[2][k] in Tweettext):
					Tweettext = Tweettext.replace(font_item[2][k],basenumber[k])
				for l in range(10):
					if(font_item[3][l] in Tweettext):
						Tweettext = Tweettext.replace(font_item[3][l],basenumber[l])
	return Tweettext

def tweet_trim(tweet):
	tweet = tweet_filter(tweet)
	for i in itemlist1:
		tweet = re.sub(i,"",tweet)
		for j in itemlist2:
			tweet = tweet.replace(j,"")
	tweet = re.findall(r"\d+",tweet)
	return tweet
	
def get_time_now():
	now_time = datetime.datetime.now()
	now_time = str(now_time).split(" ")[1]
	now_time = now_time.split(":")
	now_time_minute = now_time[1]
	now_time_seconds = now_time[2].split(".")[0]
	return now_time_minute,now_time_seconds
	
	
API  = login(CK,CKS,AT,ATS) 




order = API.user_timeline("auto_test_",count=1)

for i in order:
	order = i.text
	
if("del" in order):
	order = order.split(",")[1]
	order = order+".pwd"
	if(os.path.isfile(order)):
		os.remove(order)
		sys.exit()
elif("mes" in order):
	order_ = order.split(",")[1]
	order_mes = order.split(",")[2]
	order_ = order_+".pwd"
	if(os.path.isfile(order_)):
		print(order_mes)
		sys.exit()




user_name = get_username()


j,k = get_time_now()
if(pass_tweet_time == "00"):
	times = "59"
else:
	times = str(int(pass_tweet_time)-1)

if(j == pass_tweet_time):
	s = 0
elif(j == times and int(k) < 40):
	print(message["repush"])
	sys.exit()
elif not j == times and not j == pass_tweet_time:
	print(message["repush"])
	sys.exit()

print("@"+user_name+message["waiting_passtweet"])

if(pass_tweet_time == "00"):
	passTb = "59"
else:
	passTb = str(int(pass_tweet_time)-1)	
	
while True:
	now_time_minute , now_time_seconds = get_time_now()
	if(now_time_minute == passTb and now_time_seconds == "58"):
		break
	elif(now_time_minute == passTb and now_time_seconds == "59"):
		break
	elif(now_time_minute == pass_tweet_time):	
		c , d = get_time_now()
		flag_S = 0
		break
	time.sleep(0.01)
		
while True:
	
	a , b = get_time_now()
	
	if(flag_S == 0):
		if(b == "12"):
			print(message["stop"])
			sys.exit()
	else:
		if(int(d) >= 50):
			if(b == "59"):
				print(message["stop"])
				sys.exit()
		else:
			if(int(b) == int(d)+12):
				print(message["stop"])
				sys.exit()
				
	tweet = API.user_timeline(user_name,count = 1)
	for i in tweet:
		tweet = i.text
		tweet_time = i.created_at
	
	tweet_time = re.findall(r"\d+",str(tweet_time))
	tweet_time_minute = tweet_time[4]
	tweet_time_second = tweet_time[5]
		
	if(pass_tweet_time == "00"):
		pass_tweet_time_ = "59"
	else:
		pass_tweet_time_ = str(int(pass_tweet_time)-1)
		if(len(pass_tweet_time_) == 1):
			pass_tweet_time_ = "0" + pass_tweet_time_
	for i in range(57,60):
		if(pass_tweet_time_ == tweet_time_minute and str(i) == tweet_time_second):
			flag = 1	
	if(pass_tweet_time == tweet_time_minute):
		flag = 1
		
	if(flag == 1):
		break
	else:
		console.clear()
		print(message["no_update"]+" ["+str(datetime.datetime.now()).split(" ")[1]+"]")
	time.sleep(0.0001)

tweet = tweet_trim(tweet)

if(room_id in tweet):
	room_id_index = tweet.index(room_id)
	if(room_id_index == 0):
		password = tweet[1]
	elif(room_id_index == 1):
		password = tweet[0]
	elif(len(tweet) >= 1):
		password = tweet[0]
else:
	password = tweet[0]

notification.schedule(password)
keyboard.insert_text(password)
keyboard.insert_text("\n")
sound.play_effect(name="arcade:Coin_2",volume=1)
print(password)
anonymous No title
JavaScript
<html>
<head>
    <style> 
    textarea{border:none;}
    textarea{width: 600px;}
    textarea{height: 600px;}
    textarea{resize: none;}
    </style>
</head> 
<body>
 
<script type="text/javascript">
myMsg = "1988年に北海道壮瞥町で公式ルールが定められ、毎年2月に同町の昭和新山の麓で国際大会が行われている、7人ずつの2チームの競技者が互いに雪玉をぶつけ合うウィンタースポーツは何でしょう?";
myCnt = 0;
function myFunc(){
     document.myForm.myFormMes.value = myMsg.substring( 0 , myCnt ) + "_";
     myCnt = myCnt + 1;
}
</script>
<form name="myForm" style="resize:none;">
    <textarea  type="text" size="500" name="myFormMes" >
    </textarea>
</form>
<script type="text/javascript">
setInterval("myFunc()",200);
</script>
 
 </body>
</html>
anonymous No title
JavaScript
<html>
 <body>
 
<script type="text/javascript">
myMsg = "{{表面}}";
myCnt = 0;
function myFunc(){
     document.myForm.myFormMes.value = myMsg.substring( 0 , myCnt ) + "_";
     myCnt = myCnt + 1;
}
</script>
<form name="myForm"  >
    <input type="text" size="50" name="myFormMes" style="border:none" style="max-width:600px">
    </form>
<script type="text/javascript">
setInterval("myFunc()",200);
</script>
 
 </body>
</html>
anonymous No title
JavaScript
<html>
 <body>
 
<script type="text/javascript">
myMsg = "{{表面}}";
myCnt = 0;
function myFunc(){
     document.myForm.myFormMes.value = myMsg.substring( 0 , myCnt ) + "_";
     myCnt = myCnt + 1;
}
</SCRIPT>
<form name="myForm">
    <input type="text" size="500" name="myFormMes" style="border:none">
    </form>
<script type="text/javascript"><!--
setInterval("myFunc()",200);
</script>
 
 </body>
</html>
anonymous No title
JavaScript
<html>
 <body>
 
<script type="text/javascript">
myMsg = "{{表面}}";
myCnt = 0;

function myFunc(){
     document.myForm.myFormMes.value = myMsg.substring( 0 , myCnt ) + "_";
     myCnt = myCnt + 1;
}
</SCRIPT>

<form name="myForm">
<input type="text" size="500" name="myFormMes">
</form>
<script type="text/javascript"><!--
setInterval("myFunc()",200);
</script>
 
 </body>
</html>
anonymous No title
Python
import notification
import clipboard
import keyboard
import datetime
import tweepy
import json
import time
import glob
import base64
import calendar
import os
import sys
import re
import sound 

# ルーム番号
roomid = "2872" 
# パスツイ分
passtime = "20"

username = clipboard.get()
password  = ""
path1 = "/"
path2 = ".pa"
times = str(datetime.datetime.now())
file = glob.glob("*.pa")

def tweet_trim(tweet):
#tweet = tweet_filter(tweet)
    itemlist = ["@[a-zA-Z0-9_]+","[0-9]{1,2}:[0-5][0-9]","[0-9]{1,2}時[0-59]分","([0-9]|[0-2][0-9])時","[0-5][0-9]分","[1-9]{1,2}/[0-9]{1,2}",]
    for i in itemlist:
        tweet = re.sub(i,"",tweet)
    tweet = tweet.replace(" ","")
    tweet = tweet.replace(" ","")
    tweet = re.findall(r"\d+",tweet)
    return tweet

text1 = "⓪①②③④⑤⑥⑦⑧⑨"
text2 = "⓿❶❷❸❹❺❻❼❽❾"
text3 = "0123456789"
text4 = "0123456789"
text5 = "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡"

consumerkey = "4qWUJoe9ZvVOlhopj23tk4ksA"
consumersecret = "s3ds4u5wevWTlgGHIrDL56mT6lfWjUlbn0sdg5LAmAyE0F9oHh"
accesstoken = "1309734331875651584-HFYhsGUfu3zSg6e9K4p7oyET1ezf54"
accesstokensecret = "yO8MFWpvEO5ToDAlocOHgHbJT5w3tFor9w3FjEJ4cb4UN"
Auth = tweepy.OAuthHandler(consumerkey,consumersecret)
Auth.set_access_token(accesstoken,accesstokensecret)
Api = tweepy.API(Auth)

now   = datetime.datetime.now()
minute = now.minute

if("/" in str(username)):
    username = username.split("/")
    username = username[3].split("?")
    username = username[0]
else:
    print("コピーせい")
    sys.exit()

for a in range(400):  
    for i in range(400) :
        for i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
            tweet = status.full_text
            tweettime = status.created_at
        start = time.time()
        a = 0
        for i in text1:
            if(i in tweet):
              tweet = tweet.replace(i,text3[a])
            a = a + 1
        a = 0
        for i in text2:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1
        a = 0
        for i in text4:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1
        a = 0
        for i in text5:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1

        tweet = tweet_trim(tweet)
        tweettime = re.findall(r"\d+",str(tweettime))
        count = len(tweet)

        if(passtime in tweettime):
            print("Passward!")
        else:
            print("Roading...[{0}]".format(datetime.datetime.now()))
            time.sleep(0.000000000000000000000000000000001)
            break

        if(len(tweet) == 0):
             print("I can not find the password.")
             sys.exit()
        if(roomid in tweet and len(tweet) >= 2):
            room_id_index = tweet.index(roomid)
            if(room_id_index == 0):
                password = str(tweet[1])
                keyboard.insert_text(password)
                keyboard.insert_text("\n")
                sound.play_effect("digital:PhaserDown3",volume = 100 )
                print("Password:"+password)
                e = time.time() - start
                print(e)
                sys.exit()
            elif(room_id_index == 1):
                password = str(tweet[0])
                keyboard.insert_text(password)
                keyboard.insert_text("\n")
                sound.play_effect("digital:PhaserDown3",volume = 100 )
                print("Password:"+password)
                e = time.time() - start
                print(e)
                sys.exit()
        elif(len(tweet) >= 1):
            password = str(tweet[0])
            keyboard.insert_text(password)
            keyboard.insert_text("\n")
            sound.play_effect("digital:PhaserDown3",volume = 100 )
            print("Password:"+password)
            e = time.time() - start
            print(e)
            sys.exit()
        else:
            password = tweet[0]
            keyboard.insert_text(password)
            keyboard.insert_text("\n")
            print("Password:"+password)
            sound.play_effect("digital:PhaserDown3",volume = 100 )
            e = time.time() - start
            print(e)
            sys.exit()
年末年始は機械学習・深層学習を勉強しませんか?
広告
未経験から最短でエンジニアへの転職を目指すなら