no message
This commit is contained in:
18
Question09-MultipleFiles/util/area.php
Normal file
18
Question09-MultipleFiles/util/area.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// area.php:Ex03用
|
||||
|
||||
/**
|
||||
* 四角形の面積:縦×横
|
||||
*/
|
||||
function calcRectangle($height, $width)
|
||||
{
|
||||
return $height * $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* 三角形の面積:縦×横/2
|
||||
*/
|
||||
function calcTriangle($height, $width)
|
||||
{
|
||||
return ($height * $width) / 2;
|
||||
}
|
||||
9
Question09-MultipleFiles/util/escape.php
Normal file
9
Question09-MultipleFiles/util/escape.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// escape.php:Ex02用
|
||||
/**
|
||||
* 文字列をエスケープする関数
|
||||
*/
|
||||
function h($str)
|
||||
{
|
||||
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
6
Question09-MultipleFiles/util/hello.php
Normal file
6
Question09-MultipleFiles/util/hello.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// hello.php:Ex01用
|
||||
function getMessage()
|
||||
{
|
||||
return "Hello, world!";
|
||||
}
|
||||
12
Question09-MultipleFiles/util/redirect.php
Normal file
12
Question09-MultipleFiles/util/redirect.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// Util/redirect.php:Ex04/Ex05共通用
|
||||
/**
|
||||
* 指定したURLへリダイレクトする関数
|
||||
*
|
||||
* @param string $url リダイレクト先URL
|
||||
*/
|
||||
function redirect($url)
|
||||
{
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
}
|
||||
14
Question09-MultipleFiles/util/validate.php
Normal file
14
Question09-MultipleFiles/util/validate.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// Util/validate.php:Ex05用
|
||||
/**
|
||||
* ユーザー認証チェック関数
|
||||
* ユーザー名が "admin"、パスワードが "secret" の場合のみ認証成功
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return bool 認証成功ならtrue
|
||||
*/
|
||||
function checkUser($username, $password)
|
||||
{
|
||||
return ($username === 'admin' && $password === 'secret');
|
||||
}
|
||||
Reference in New Issue
Block a user