anonymous No title
PHP
Nvhhri https://newfasttadalafil.com/ - Cialis Propecia Laake <a href=https://newfasttadalafil.com/>Cialis</a> Womspd https://newfasttadalafil.com/ - cialis generic 5mg
anonymous PHPでスリーカードポーカー(簡略版)
PHP
<?php

const CARDS = [
    '2' => 2
    , '3' => 3
    , '4' => 4
    , '5' => 5
    , '6' => 6
    , '7' => 7
    , '8' => 8
    , '9' => 9
    , '10' => 10
    , 'J' => 11
    , 'Q' => 12
    , 'K' => 13
    , 'A' => 14
];

const HIGH_CARD = 'high card';
const PAIR = 'pair';
const STRAIGHT = 'straight';
const THREE_CARD = 'three card';

const HAND_RANKS = [
    'high card' => 0
    ,'pair' => 1
    ,'straight' => 2
    ,'three card' => 3
];


function showDown (string $card11, string $card12, string $card13, string $card21, string $card22, string $card23): array
{
    $cards = [$card11, $card12, $card13, $card21, $card22, $card23];
    $cardRanks = [];
    // 6枚のカードの文字列から数字部分のみを抽出し、新しい配列$cardNumbersに格納
    // その後、CARDS定数を使って数字ごとのランクに変換
    foreach ($cards as $card) {
        array_push($cardRanks, CARDS[substr($card, 1)]);
    }
    // 3つずつ各プレイヤーの手札として振り分ける
    $playerCardRanks = array_chunk($cardRanks, 3);
    // プレイヤーごとの役をユーザー定義関数checkHandsで決定。
    // $playerCardRanksを2プレイヤー分に分けてからでないと、checkHands関数で2次元配列を扱うことになってしまう上に、配列の引数2つというのも関数を定義しづらい
    $player1Hand = checkHands($playerCardRanks[0]);
    $player2Hand = checkHands($playerCardRanks[1]);
    // 勝敗を決定
    $winner = decideWinner($player1Hand, $player2Hand);
    return [$player1Hand['hand'], $player2Hand['hand'], $winner];
}

function checkHands(array $playerCardRanks): array
{
    $hand = HIGH_CARD;
    if (isThreeCard($playerCardRanks)) {
        $hand = THREE_CARD;
    } elseif (isPair($playerCardRanks)) {
        $hand = PAIR;
    } elseif (isStraight($playerCardRanks)) {
        $hand = STRAIGHT;
    }
    rsort($playerCardRanks);

    // 手札がa,2,3の場合はaを最弱にする
    // aのランク14をカードの種類の数13で割った余りは1なので、それをaのランクとする
    if ($playerCardRanks[1] === $playerCardRanks[2] + 1 && $playerCardRanks[2] === $playerCardRanks[0] % count(CARDS) + 1) {
        $playerCardRanks[0] = $playerCardRanks[0] % count(CARDS);
    }

    return [
        'hand' => $hand
        ,'handRank' => HAND_RANKS[$hand]
        ,'biggestNum' => $playerCardRanks[0]
        ,'middleNum' => $playerCardRanks[1]
        ,'smallestNum' => $playerCardRanks[2]
    ];
}

function isThreeCard(array $playerCardRanks): bool
{
    // 一つ目の値の数がカード全体の枚数に等しいとき(すなわち、全てのカードの値が同じとき)、trueを返す(ボツ案)
    // if (array_count_values($playerCardRanks)[0] === count($playerCardRanks)) {
    //     return true;

    // それぞれのプレイヤーの手札のうち、重複する種類が1種類の(すべて重複する)ときにtrueを返す
    if (count(array_unique($playerCardRanks)) === 1) {
        return true;
    } else {
        return false;
    }

    // ここは無難に、それぞれのカードの値が等しいときでも可
    // if ($playerCardRanks[0] === $playerCardRanks[1] && $playerCardRanks[1] === $playerCardRanks[2]) {
    //     return true;
    // }
}

function isPair(array $playerCardRanks): bool
{
    // if (count(array_count_values($playerCardRanks)) === 2) {
    //     return true; (ボツ案)

    // 重複する値の種類が2の時
    if (count(array_unique($playerCardRanks)) === 2) {
        return true;
    } else {
        return false;
    }
}

function isStraight(array $playerCardRanks): bool
{
    rsort($playerCardRanks);
    $biggestCard = $playerCardRanks[0];
    $middleCard = $playerCardRanks[1];
    $smallestCard = $playerCardRanks[2];
    // echo('biggestCard:' . $biggestCard);

    // 1番大きい数が2番目の数より1大きく、2番目の数が3番目の数より大きい場合
    if ($biggestCard === $middleCard + 1 && $middleCard === $smallestCard + 1) {
        return true;
    // 1番大きい数がA、2番目の数が3、1番小さい数が2の場合を想定している。
    // AのCardRank14をカードの種類の数13で割った余りは1なので、AのCardRankをそれにすり替える。(リングバッファーのアルゴリズムから着想。)
    } elseif ($middleCard === $smallestCard + 1 && $smallestCard === $biggestCard % count(CARDS) + 1) {
        return true;
    } else {
        return false;
    }
}

function decideWinner (array $player1Hand, array $player2Hand): int
{

    // 勝敗を決める要素をまとめる。それぞれの役、1番大きい数、2番目の数、1番小さい数
    $judgementElements = ['handRank', 'biggestNum', 'middleNum', 'smallestNum'];

    // それぞれの要素ごとに大小を比較していって、大小が決まった時点で結果を返す
    // いずれの要素でも決着がつかなかった場合に、0(引き分け)を返す
    foreach ($judgementElements as $judgementElement) {
        if($player1Hand[$judgementElement] > $player2Hand[$judgementElement]) {
            return 1;
        } elseif ($player2Hand[$judgementElement] > $player1Hand[$judgementElement]) {
            return 2;
        }
    }
    return 0;
}

var_dump(showDown('SK', 'D9', 'CJ', 'S10', 'H10', 'D6'));
var_dump(showDown('DK', 'S2', 'HA', 'C4', 'H5', 'S6'));
var_dump(showDown('S9', 'CJ', 'DK', 'C3', 'C3', 'H3'));
var_dump(showDown('H3', 'D4', 'C5', 'HK', 'S10', 'DK'));
var_dump(showDown('S3', 'H3', 'C3', 'D10', 'SK', 'D10'));
var_dump(showDown('C3', 'S3', 'H3', 'CK', 'SJ', 'SQ'));
var_dump(showDown('DJ', 'HK', 'S9', 'CQ', 'D9', 'S10'));
var_dump(showDown('C7', 'S5', 'H3', 'S5', 'S7', 'D3'));
var_dump(showDown('CA', 'DA', 'CK', 'D2', 'D2', 'C3'));
var_dump(showDown('HK', 'DK', 'SA', 'CA', 'SA', 'SK'));
var_dump(showDown('D4', 'D7', 'K7', 'D6', 'K4', 'C6'));
var_dump(showDown('SK', 'D9', 'CJ', 'S10', 'H10', 'D6'));
var_dump(showDown('S4', 'C4', 'S7', 'S4', 'S4', 'C7'));
var_dump(showDown('SA', 'DQ', 'DK', 'CA', 'C2', 'D3'));
var_dump(showDown('SA', 'DK', 'DQ', 'CK', 'CQ', 'DJ'));
var_dump(showDown('H2', 'D3', 'D4', 'HA', 'C2', 'S3'));
var_dump(showDown('S2', 'S3', 'S4', 'C2', 'C3', 'D4'));
var_dump(showDown('S2', 'S2', 'S2', 'DA', 'HA', 'CA'));
var_dump(showDown('CK', 'CK', 'SK', 'SA', 'HA', 'DA'));
var_dump(showDown('D2', 'C2', 'S2', 'C3', 'H3', 'S3'));

anonymous No title
PHP
What is it the word means? 
https://foirstdownload.org/map1.php
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>
Don't you submit code?
Submit