Last active
June 3, 2019 18:46
-
-
Save PJZ9n/97a5153ec5ef553dbe2855bf16512ba9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $errors = []; | |
| if (!isset($_POST["email"])) { | |
| $errors[] = "メールアドレス未送信"; | |
| } else { | |
| $email = $_POST["email"]; | |
| } | |
| if (!isset($_POST["userid"])) { | |
| $errors[] = "ユーザーID未送信"; | |
| } else { | |
| $userid = $_POST["userid"]; | |
| } | |
| //メールアドレス判定HTML5準拠 | |
| if (!is_string($email) || $email === "" || !preg_match('/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/', $email)) { | |
| //こいつ | |
| $errors[] = "メールアドレス未入力もしくは不正"; | |
| } | |
| if (!is_string($userid) || $userid === "" || !ctype_digit(strval($userid))) { | |
| //こいつ | |
| $errors[] = "ユーザーID未入力もしくは不正"; | |
| } | |
| if (count($errors) === 0) { | |
| //TODO: 正常時処理書く | |
| } | |
| ?> | |
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <!-- Required Meta --> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <!-- Load CSS --> | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | |
| integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | |
| crossorigin="anonymous"> | |
| <!-- Main Header --> | |
| <title>PJHosting</title> | |
| </head> | |
| <body> | |
| <!-- Header --> | |
| <header style="text-align: center"> | |
| <h1>PJHosting</h1> | |
| </header> | |
| <!-- Main Content --> | |
| <div class="container-fluid"> | |
| <div class="row"> | |
| <div class="col-sm-2" style="background-color: azure"></div> | |
| <div class="col-sm-8" style="background-color: snow"> | |
| <?php if (count($errors) === 0): ?> | |
| <!-- 正常時 表示側 --> | |
| <?php else: ?> | |
| <?php foreach ($errors as $error): ?> | |
| <div class="alert alert-warning" role="alert"> | |
| <?php echo $error ?> | |
| </div> | |
| <?php endforeach; ?> | |
| <?php endif; ?> | |
| </div> | |
| <div class="col-sm-2" style="background-color: azure"></div> | |
| </div> | |
| </div> | |
| <!-- Footer --> | |
| <footer style="text-align: center"> | |
| <p>Copyright © PJHosting allrights reserved.</p> | |
| </footer> | |
| <!-- Load JS --> | |
| <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" | |
| integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" | |
| crossorigin="anonymous"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" | |
| integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" | |
| crossorigin="anonymous"></script> | |
| <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" | |
| integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" | |
| crossorigin="anonymous"></script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment