このコミットが含まれているのは:
守矢諏訪子 2022-10-25 18:09:58 +09:00
コミット 9c2a5ad8cd
22個のファイルの変更225行の追加212行の削除

ファイルの表示

@ -1,19 +1,21 @@
<?php
// アプリ
define('APP_NAME', 'LoliPHP');
define("APP_NAME", "LoliPHP");
define("HTML_VER", "XHTML"); // XHTML、HTML5
define("CAN_MOBILE", false);
// データベース
define('DB_CONN', 'mysql');
define('DB_HOST', 'localhost');
define('DB_PORT', 3306);
define('DB_USER', '');
define('DB_PASS', '');
define('DB_NAME', '');
define("DB_CONN", "mysql");
define("DB_HOST", "localhost");
define("DB_PORT", 3306);
define("DB_USER", "");
define("DB_PASS", "");
define("DB_NAME", "");
// CURL
define('API_URI', '');
define('API_AUTH', null);
define("API_URI", "");
define("API_AUTH", null);
// ハッシュ
define('PASSWD_PEPPER', ''); // オススメpwgen -ycnB1 40
define("PASSWD_PEPPER", ""); // オススメpwgen -ycnB1 40
?>

ファイルの表示

@ -1,13 +1,13 @@
<?php
require_once('helper/cookie.php'); // クッキー・Cookie
require_once('helper/curl.php'); // CURL
require_once('helper/db.php'); // データベースエンジン・Database engine
require_once('helper/debug.php'); // デバッガー・Debugger
require_once('helper/hash.php'); // ハッシュ・Hash
require_once('helper/mail.php'); // メール・Mail
require_once('helper/php8compat.php'); // PHP8を実行していない場合・If not running PHP8
require_once('helper/request.php'); // リクエスト・Request
require_once('helper/session.php'); // セッション・Session
require_once('helper/upload.php'); // ファイルアップロード・File upload
require_once('helper/uuid.php'); // UUIDv4
require_once("helper/cookie.php"); // クッキー・Cookie
require_once("helper/curl.php"); // CURL
require_once("helper/db.php"); // データベースエンジン・Database engine
require_once("helper/debug.php"); // デバッガー・Debugger
require_once("helper/hash.php"); // ハッシュ・Hash
require_once("helper/mail.php"); // メール・Mail
require_once("helper/php8compat.php"); // PHP8を実行していない場合・If not running PHP8
require_once("helper/request.php"); // リクエスト・Request
require_once("helper/session.php"); // セッション・Session
require_once("helper/upload.php"); // ファイルアップロード・File upload
require_once("helper/uuid.php"); // UUIDv4
?>

ファイルの表示

@ -1,8 +1,7 @@
<?php
function getcookie (string $name): string {
return htmlspecialchars($_COOKIE[$name]);
return isset($_COOKIE[$name]) ? htmlspecialchars($_COOKIE[$name]) : "";
}
function getrawcookie (string $name): string {
return $_COOKIE[$name];
}

ファイルの表示

@ -1,20 +1,20 @@
<?php
require_once('../config.php');
require_once("../config.php");
function lolicurl ($url, $param='', $method='get', $contenttype='json') {
function lolicurl ($url, $param="", $method="get", $contenttype="json") {
set_time_limit(0);
$header = ['Content-Type: application/'.$contenttype, 'Host: '.str_replace('https://', '', API_URI)];
$header = ["Content-Type: application/".$contenttype, "Host: ".str_replace("https://", "", API_URI)];
if (!is_null(API_AUTH)) {
$header[] = 'Authorization: Bearer '.API_AUTH;
$header[] = "Authorization: Bearer ".API_AUTH;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, API_URI.$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if ($method == 'post') {
if ($method == "post") {
curl_setopt($ch, CURLOPT_POST, 1);
if ($param != '') curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
if ($param != "") curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

ファイルの表示

@ -1,37 +1,37 @@
<?php
require_once('../config.php');
require_once("../config.php");
/* val
*
* select => ['var1', 'var2'...]
* insert|update|where => ['key1' => 'value1', 'key2' => 'value2'...]
* order => ['var', 'asc'|'desc']
* select => ["var1", "var2"...]
* insert|update|where => ["key1" => "value1", "key2" => "value2"...]
* order => ["var", "asc"|"desc"]
* limit => int
* */
function lolidb (string $table, array $val, string $mode='select'): array|bool {
function lolidb (string $table, array $val, string $mode="select"): array|bool {
// モードは違う場合、やめる。If the mode is wrong, stop.
if ($mode != 'select' && $mode != 'one' && $mode != 'insert' && $mode != 'update' && $mode != 'delete') {
if ($mode != "select" && $mode != "one" && $mode != "insert" && $mode != "update" && $mode != "delete") {
dd("モードは「select」、「one」、「insert」、「update」、「delete」です。\nMode should be \"select\", \"one\", \"insert\", \"update\", or \"delete\".");
return false;
}
// 順のチェック。Check order.
if (isset($val['order'])) {
if (isset($val["order"])) {
// selectかoneじゃない場合。If not select or one.
if ($mode !== 'select' || $mode !== 'one') {
if ($mode !== "select" || $mode !== "one") {
dd("「order」は「select」又は「one」のみで使えます。\n\"order\" can only be used with \"select\" or \"one\".");
return false;
}
// 複数の場合。If multiple.
if (count($val['order'] > 1)) {
if (count($val["order"] > 1)) {
dd("複数「order」は未対応です。\nMultiple \"order\" is not yet supported.");
return false;
}
// ascかdescかどうか。Whether it's asc or desc.
foreach ($val['order'] as $k => $v) {
if ($v !== 'asc' && $v !== 'desc') {
// ascかdescかどうか。Whether it"s asc or desc.
foreach ($val["order"] as $k => $v) {
if ($v !== "asc" && $v !== "desc") {
dd("「order」は「asc」又は「desc」です。\n\"order\" should be \"asc\" or \"desc\".");
return false;
}
@ -39,28 +39,28 @@
}
// 限界のチェック。Check limit.
if (($mode === 'select' || $mode === 'one') && isset($val['limit'])) {
if (($mode === "select" || $mode === "one") && isset($val["limit"])) {
// oneの場合。If one.
if ($mode === 'one') {
if ($mode === "one") {
dd("「one」の場合、「limit」はいつでも「1」です。「limit」は1以上は必要の場合、「select」を使って下さい。\nIn case of \"one\", \"limit\" is always \"1\". If \"limit\" needs to be more than \"1\", please use \"select\".");
return false;
}
// selectじゃない場合。If not select.
else if ($mode !== 'select') {
else if ($mode !== "select") {
dd("「insert」、「update」及び「delete」で、「limit」を使えません。\n\"limit\" cannot be used with \"insert\", \"update\", and \"delete\".");
return false;
}
}
// insertの場合。In case of insert.
if ($mode === 'insert' && !isset($val['insert'])) {
if ($mode === "insert" && !isset($val["insert"])) {
dd("「insert」モードの場合、「insert」値は必須です。\nIn case of \"insert\" mode, \"insert\" value is necessary.");
return false;
}
// updateの場合。In case of update.
if ($mode === 'update' && !isset($val['update'])) {
if ($mode === "update" && !isset($val["update"])) {
dd("「update」モードの場合、「update」値は必須です。\nIn case of \"update\" mode, \"update\" value is necessary.");
return false;
}
@ -69,94 +69,94 @@
$mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_TABLE);
$result = null;
if ($mode == 'select' || $mode == 'one') {
if ($mode == "select" || $mode == "one") {
// select値がなければ、全部を選択する。If there is no select value, select everything.
if (!isset($val['select'])) {
$val['select'] = ['*'];
if (!isset($val["select"])) {
$val["select"] = ["*"];
}
$query = 'SELECT '.$val['select'].' FROM '.$table;
$query = "SELECT ".$val["select"]." FROM ".$table;
if (isset($val['where'])) {
$query .= ' WHERE ';
foreach ($val['where'] as $k => $v) {
$query .= $k.' = '.$v;
if ($k !== array_key_last($val['where'])) $query .= ' AND ';
if (isset($val["where"])) {
$query .= " WHERE ";
foreach ($val["where"] as $k => $v) {
$query .= $k." = ".$v;
if ($k !== array_key_last($val["where"])) $query .= " AND ";
}
}
if (isset($val['order'])) {
$query .= ' ORDER BY ';
foreach ($val['order'] as $k => $v) {
if (isset($val["order"])) {
$query .= " ORDER BY ";
foreach ($val["order"] as $k => $v) {
$query .= $k;
$query .= ' '.strtoupper($v);
$query .= " ".strtoupper($v);
}
}
if ($mode == 'one') {
$query .= ' LIMIT 1';
if ($mode == "one") {
$query .= " LIMIT 1";
}
else {
if (isset($val['limit'])) {
$query .= ' LIMIT '.(int)$val['limit'];
if (isset($val["limit"])) {
$query .= " LIMIT ".(int)$val["limit"];
}
}
$result = mysqli_query($mysqli, $query.';');
$result = mysqli_query($mysqli, $query.";");
$row = mysqli_fetch_assoc($result);
}
else {
if ($mode == 'insert') {
$query .= 'INSERT INTO '.$table.' (';
foreach ($val['insert'] as $k => $v) {
if ($mode == "insert") {
$query .= "INSERT INTO ".$table." (";
foreach ($val["insert"] as $k => $v) {
$query .= $k;
if ($k !== array_key_last($val['insert'])) {
$query .= ', ';
if ($k !== array_key_last($val["insert"])) {
$query .= ", ";
}
}
$query .= ') VALUES (';
foreach ($val['insert'] as $k => $v) {
$query .= ") VALUES (";
foreach ($val["insert"] as $k => $v) {
$query .= $v;
if ($k !== array_key_last($val['insert'])) {
$query .= ', ';
if ($k !== array_key_last($val["insert"])) {
$query .= ", ";
}
}
$query .= ')';
$query .= ")";
}
else if ($mode == 'update') {
$query .= 'UPDATE '.$table.' SET ';
foreach ($val['update'] as $k => $v) {
$query .= $k.' = '.$v;
if ($k !== array_key_last($val['update'])) {
$query .= ', ';
else if ($mode == "update") {
$query .= "UPDATE ".$table." SET ";
foreach ($val["update"] as $k => $v) {
$query .= $k." = ".$v;
if ($k !== array_key_last($val["update"])) {
$query .= ", ";
}
}
if (isset($val['where'])) {
$query .= ' WHERE ';
foreach ($val['where'] as $k => $v) {
$query .= $k.' = '.$v;
if ($k !== array_key_last($val['where'])) {
$query .= ' AND ';
if (isset($val["where"])) {
$query .= " WHERE ";
foreach ($val["where"] as $k => $v) {
$query .= $k." = ".$v;
if ($k !== array_key_last($val["where"])) {
$query .= " AND ";
}
}
}
}
else if ($mode == 'delete') {
$query .= 'DELETE FROM '.$table;
else if ($mode == "delete") {
$query .= "DELETE FROM ".$table;
if (isset($val['where'])) {
$query .= ' WHERE ';
foreach ($val['where'] as $k => $v) {
$query .= $k.' = '.$v;
if ($k !== array_key_last($val['where'])) {
$query .= ' AND ';
if (isset($val["where"])) {
$query .= " WHERE ";
foreach ($val["where"] as $k => $v) {
$query .= $k." = ".$v;
if ($k !== array_key_last($val["where"])) {
$query .= " AND ";
}
}
}
}
$stmt = mysqli_prepare($mysqli, $query.';');
$stmt = mysqli_prepare($mysqli, $query.";");
}
return $row;

ファイルの表示

@ -1,22 +1,23 @@
<?php
function dd ($val) {
echo '<pre>';
echo "<style> body { background: #232629; color: #fcfcfc; } </style>";
echo "<pre>";
var_dump($val);
echo '</pre>';
echo "</pre>";
die();
}
function lolilog (string $val, string $mode='info'): bool {
if (!$file = fopen('./lolilog', 'a+')) {
dd('lolilogファイルを開けられません。');
function lolilog (string $val, string $mode="info"): bool {
if (!$file = fopen("./lolilog", "a+")) {
dd("lolilogファイルを開けられません。");
return false;
}
$time = time();
$logtext = '['.date('Y-m-d H:i:s T', $time).' ('.$time.') - '.mb_strtoupper($mode)."]\n".$val."\n\n";
$logtext = "[".date("Y-m-d H:i:s T", $time)." (".$time.") - ".mb_strtoupper($mode)."]\n".$val."\n\n";
if (fwrite($file, $logtext) === false) {
dd('lolilogファイルに書き出しに失敗しました。');
dd("lolilogファイルに書き出しに失敗しました。");
return false;
}

ファイルの表示

@ -1,5 +1,5 @@
<?php
require_once('../config.php');
require_once("../config.php");
function tokengen (int $bytes=24): string {
return bin2hex(random_bytes($bytes));
@ -12,18 +12,18 @@
do {
$cost++;
$start = microtime(true);
password_hash('kero', PASSWORD_ARGON2ID, ['cost' => $cost]);
password_hash("kero", PASSWORD_ARGON2ID, ["cost" => $cost]);
$end = microtime(true);
} while (($end - $start) < $millisec);
$addpepper = hash_hmac('sha256', $password, PASSWD_PEPPER);
$addpepper = hash_hmac("sha256", $password, PASSWD_PEPPER);
$addmd5 = md5($addpepper);
return password_hash($addmd5, PASSWORD_ARGON2ID, ['cost' => $cost]);
return password_hash($addmd5, PASSWORD_ARGON2ID, ["cost" => $cost]);
}
function verifypasswd (string $raw, string $crypt): bool {
$addpepper = hash_hmac('sha256', $raw, PASSWD_PEPPER);
$addpepper = hash_hmac("sha256", $raw, PASSWD_PEPPER);
$addmd5 = md5($addpepper);
return password_verify($addmd5, $crypt);

ファイルの表示

@ -1,31 +1,31 @@
<?php
if (!function_exists('str_starts_with')) {
if (!function_exists("str_starts_with")) {
function str_starts_with (string $haystack, string $needle): bool {
return (string)$needle !== '' && strncmp($haystack, $needle, strlen($needle)) === 0;
return (string)$needle !== "" && strncmp($haystack, $needle, strlen($needle)) === 0;
}
}
if (!function_exists('str_ends_with')) {
if (!function_exists("str_ends_with")) {
function str_ends_with (string $haystack, string $needle): bool {
$needle_len = strlen($needle);
return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, - $needle_len));
}
}
if (!function_exists('str_contains')) {
if (!function_exists("str_contains")) {
function str_contains (string $haystack, string $needle): bool {
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
return $needle !== "" && mb_strpos($haystack, $needle) !== false;
}
}
if (!function_exists('array_key_first')) {
if (!function_exists("array_key_first")) {
function array_key_first (array $array): int|string|null {
if (!is_array($array) || empty($array)) return NULL;
return array_keys($array)[0];
}
}
if (!function_exists('array_key_last')) {
if (!function_exists("array_key_last")) {
function array_key_last (array $array): int|string|null {
if (!is_array($array) || empty($array)) return NULL;
return array_keys($array)[count($array)-1];

ファイルの表示

@ -1,31 +1,31 @@
<?php
function request (string $name): array {
if (isset($_POST[$name])) {
return ['post' => htmlspecialchars($name)];
return ["post" => htmlspecialchars($name)];
}
else if (isset($_GET[$name])) {
return ['get' => htmlspecialchars($name)];
return ["get" => htmlspecialchars($name)];
}
else if (isset($_REQUEST[$name])) {
return ['request' => htmlspecialchars($name)];
return ["request" => htmlspecialchars($name)];
}
return ['error' => ''];
return ["error" => ""];
}
function request_all (): array {
$res = [];
if (!empty($_POST)) {
$res['post'] = [];
foreach ($_POST as $k => $v) $res['post'][$k] = htmlspecialchars($v);
$res["post"] = [];
foreach ($_POST as $k => $v) $res["post"][$k] = htmlspecialchars($v);
}
if (!empty($_GET)) {
$res['get'] = [];
foreach ($_GET as $k => $v) $res['get'][$k] = htmlspecialchars($v);
$res["get"] = [];
foreach ($_GET as $k => $v) $res["get"][$k] = htmlspecialchars($v);
}
if (!empty($_REQUEST)) {
$res['request'] = [];
foreach ($_REQUEST as $k => $v) $res['request'][$k] = htmlspecialchars($v);
$res["request"] = [];
foreach ($_REQUEST as $k => $v) $res["request"][$k] = htmlspecialchars($v);
}
return $res;

ファイルの表示

@ -1,55 +1,55 @@
<?php
require_once('uuid.php');
require_once("uuid.php");
function fileextension (string $fname): string {
$ext = strrpos($fname, '.');
$ext = strrpos($fname, ".");
return $ext === false ? '' : substr($fname, $ext + 1);
return $ext === false ? "" : substr($fname, $ext + 1);
}
// ISOはfalseだったら、kB、MB、GB、TBになります。
// trueの場合、KiB、MiB、GiB、TiBです。
function humanreadablesize (int $byte, bool $iso=true): string {
$bit = $iso ? 1024 : 1000;
$res = 'B';
$res = "B";
$size = $byte;
if ($byte >= ($bit * $bit * $bit * $bit * $bit)) {
//dd(5);
$size = $byte / ($bit * $bit * $bit * $bit * $bit);
$res = $iso ? 'TiB' : 'TB';
$res = $iso ? "TiB" : "TB";
}
else if ($byte >= ($bit * $bit * $bit * $bit)) {
//dd(4);
$size = $byte / ($bit * $bit * $bit * $bit);
$res = $iso ? 'TiB' : 'TB';
$res = $iso ? "TiB" : "TB";
}
else if ($byte >= ($bit * $bit * $bit)) {
//dd(3);
$size = $byte / ($bit * $bit * $bit);
$res = $iso ? 'GiB' : 'GB';
$res = $iso ? "GiB" : "GB";
}
else if ($byte >= ($bit * $bit)) {
//dd(2);
$size = $byte / ($bit * $bit);
$res = $iso ? 'MiB' : 'MB';
$res = $iso ? "MiB" : "MB";
}
else if ($byte >= $bit) {
//dd(1);
$size = $byte / $bit;
$res = $iso ? 'KiB' : 'kB';
$res = $iso ? "KiB" : "kB";
}
//dd($size);
return number_format($size, 2).' '.$res;
return number_format($size, 2)." ".$res;
}
function getmimetype (string $fname): string|null {
$i = 0;
foreach ($_FILES as $v) {
if ($fname == $v['name'][$i]) {
return $v['type'][$i];
if ($fname == $v["name"][$i]) {
return $v["type"][$i];
}
$i++;
@ -63,20 +63,20 @@
$i = 0;
foreach ($_FILES as $file) {
if ($file['error'][$i] != 0) {
$err = '';
switch ($file['error'][$i]) {
case 1: $err = 'php.iniでの「upload_max_filesize」値が超えています。ファイルサイズ'.humanreadablesize($file['size'][$i]); break;
case 2: $err = 'HTMLフォームの「MAX_FILE_SIZE」値が超えています。ファイルサイズ'.humanreadablesize($file['size'][$i]); break;
case 3: $err = 'ファイルの部分の失敗です。'; break;
case 4: $err = 'ファイルをアップロード出来ません。'; break;
case 5: $err = '不明'; break;
case 6: $err = '仮フォルダがありません。'; break;
case 7: $err = 'uploadフォルダに書き込めません。'; break;
case 8: $err = '拡張子がありません。'; break;
if ($file["error"][$i] != 0) {
$err = "";
switch ($file["error"][$i]) {
case 1: $err = "php.iniでの「upload_max_filesize」値が超えています。ファイルサイズ".humanreadablesize($file["size"][$i]); break;
case 2: $err = "HTMLフォームの「MAX_FILE_SIZE」値が超えています。ファイルサイズ".humanreadablesize($file["size"][$i]); break;
case 3: $err = "ファイルの部分の失敗です。"; break;
case 4: $err = "ファイルをアップロード出来ません。"; break;
case 5: $err = "不明"; break;
case 6: $err = "仮フォルダがありません。"; break;
case 7: $err = "uploadフォルダに書き込めません。"; break;
case 8: $err = "拡張子がありません。"; break;
}
$res[$file['name'][$i]] = $err;
$res[$file["name"][$i]] = $err;
}
$i++;
@ -86,18 +86,18 @@
}
function loliupload (array $files): bool {
$dir = __DIR__.'/../public/static/upload/';
$fname = '';
$dir = __DIR__."/../public/static/upload/";
$fname = "";
if (!file_exists($dir)) {
mkdir($dir, 0777);
}
do {
$fname = uuid().'.'.fileextension($files['name'][0]);
$fname = uuid().".".fileextension($files["name"][0]);
} while (file_exists($dir.$fname));
if (move_uploaded_file($files['tmp_name'][0], $dir.$fname)) {
if (move_uploaded_file($files["tmp_name"][0], $dir.$fname)) {
return true;
}

ファイルの表示

@ -1,7 +1,7 @@
<?php
function uuid () {
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
"%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 32bitlow
mt_rand(0, 0xffff), // 16bitmid
mt_rand(0, 0x0fff) | 0x4000, // 16bithigh

ファイルの表示

@ -1,25 +1,36 @@
<?php
require_once('../src/config.php');
require_once('../helper.php');
$path = $_SERVER['REQUEST_URI'] == '/' ? '/home' : $_SERVER['REQUEST_URI'];
if (!file_exists('../src'.$path.'/index.php')) $path = '/404';
if (session_status() == 1) session_start();
require_once("../src/config.php");
require_once("../helper.php");
$path = $_SERVER["REQUEST_URI"] == "/" ? "/home" : $_SERVER["REQUEST_URI"];
$path = explode("?", $path)[0];
if (!file_exists("../src".$path."/index.php")) $path = "/404";
require_once('../src'.$path.'/index.php');
require_once("../src".$path."/index.php");
?>
<?php if (HTML_VER == "HTML5") { ?>
<!DOCTYPE html>
<html lang="ja">
<?php } else { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" lang="ja" xml:lang="ja">
<?php } ?>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<meta name="title" content="<?php echo $sitename.': '.$title; ?>" />
<meta name="description" content="<?php echo $sitedesc; ?>" />
<meta property="og:title" content="<?php echo $sitename; ?>" />
<meta name="title" content="<?= $sitename.": ".$title ?>" />
<meta name="description" content="<?= $sitedesc ?>" />
<?php if (CAN_MOBILE) { ?><meta name="viewport" content="width=device-width, initial-scale=1.0" /><?php }?>
<?php if (HTML_VER == "HTML5") { ?>
<meta property="og:title" content="<?= $sitename ?>" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="ja_JP" />
<meta property="og:site_name" content="<?php echo $sitename.': '.$title; ?>" />
<meta property="og:url" content="<?php echo $siteurl; ?>" />
<meta property="og:image" content="./static/<?php echo $thumbnail; ?>" />
<title><?php echo $sitename.': '.$title; ?></title>
<meta property="og:site_name" content="<?= $sitename.": ".$title ?>" />
<meta property="og:url" content="<?= $siteurl ?>" />
<meta property="og:image" content="./static/<?= $thumbnail ?>" />
<?php } ?>
<title><?= $sitename.": ".$title ?></title>
<link rel="stylesheet" type="text/css" href="./static/style.css" />
<?php if (isset($css)) { ?><link rel="stylesheet" type="text/css" href="./static/<?= $css ?>.css" /> <?php } ?>
</head>
<body>
<?php include_once($childview); ?>

ファイルの表示

@ -1,4 +1,4 @@
<?php
$title = 'エラー';
$childview = '../ui/404/index.php';
$title = "エラー";
$childview = "../ui/404/index.php";
?>

ファイルの表示

@ -1,6 +1,6 @@
<?php
$title = 'helperテスト';
$childview = '../ui/about/index.php';
$title = "helperテスト";
$childview = "../ui/about/index.php";
dd($title);
?>

ファイルの表示

@ -1,7 +1,7 @@
<?php
$sitename = 'アプリ';
$sitedesc = 'PHP用エンジンです。';
$siteurl = 'http://127.0.0.1:8000'; // cd ~/dev/phpengine/public && php -S 127.0.0.1:8000
$thumbnail = 'applogo.png';
include('../public/index.php');
$sitename = "アプリ";
$sitedesc = "PHP用エンジンです。";
$siteurl = "http://127.0.0.1:8000"; // cd ~/dev/phpengine/public && php -S 127.0.0.1:8000
$thumbnail = "applogo.png";
include("../public/index.php");
?>

ファイルの表示

@ -1,15 +1,15 @@
<?php
if (isset($_POST['lolicon_cookie'])) {
if (isset($_POST["lolicon_cookie"])) {
// 2時間後消えられます。
setcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
//setrawcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
header('Location: /cookie', 301);
setcookie("lolicon_cookie", $_POST["lolicon_cookie"], ["expires" => time()+60*60*2, "path" => "/cookie", "httponly" => true]);
//setrawcookie("lolicon_cookie", $_POST["lolicon_cookie"], ["expires" => time()+60*60*2, "path" => "/cookie", "httponly" => true]);
header("Location: /cookie", 301);
}
$title = 'クッキー'; // 必須・Requirement
$sitedesc = 'クッキーの例え'; // config.phpの文字の交換・Change character of config.php
$siteurl .= '/cookie'; // config.phpの文字に追加・Add to character of config.php
$childview = '../ui/cookie/index.php'; // 必須・Requirement
$mycookie = getcookie('lolicon_cookie');
//$mycookie = getrawcookie('lolicon_cookie');
$title = "クッキー"; // 必須・Requirement
$sitedesc = "クッキーの例え"; // config.phpの文字の交換・Change character of config.php
$siteurl .= "/cookie"; // config.phpの文字に追加・Add to character of config.php
$childview = "../ui/cookie/index.php"; // 必須・Requirement
$mycookie = getcookie("lolicon_cookie");
//$mycookie = getrawcookie("lolicon_cookie");
?>

ファイルの表示

@ -1,9 +1,9 @@
<?php
$title = 'CURL';
$siteurl .= '/curl';
$childview = '../ui/curl/index.php';
$title = "CURL";
$siteurl .= "/curl";
$childview = "../ui/curl/index.php";
// テストするには、config.phpでの「API_AUTH」値を「https://social.076.ne.jp」、又は違うPleromaインスタンスのホスト名に設定して下さい。
// To test, please set "API_AUTH" in config.php to "https://social.076.ne.jp", or a different Pleroma instance host name.
$result = lolicurl('/api/pleroma/frontend_configurations');
$result = lolicurl("/api/pleroma/frontend_configurations");
?>

ファイルの表示

@ -1,9 +1,9 @@
<?php
$title = 'パスワード創作';
$siteurl .= '/hash';
$childview = '../ui/hash/index.php';
$title = "パスワード創作";
$siteurl .= "/hash";
$childview = "../ui/hash/index.php";
if (isset($_POST['password'])) {
$setpasswd = setpasswd($_POST['password']);
if (isset($_POST["password"])) {
$setpasswd = setpasswd($_POST["password"]);
}
?>

ファイルの表示

@ -1,6 +1,6 @@
<?php
$title = 'ホームページ'; // 必須・Requirement
$sitedesc = 'ホームページのみの説明。'; // config.phpの文字の交換・Change character of config.php
$siteurl .= '/home'; // config.phpの文字に追加・Add to character of config.php
$childview = '../ui/home/index.php'; // 必須・Requirement
$title = "ホームページ"; // 必須・Requirement
$sitedesc = "ホームページのみの説明。"; // config.phpの文字の交換・Change character of config.php
$siteurl .= "/home"; // config.phpの文字に追加・Add to character of config.php
$childview = "../ui/home/index.php"; // 必須・Requirement
?>

ファイルの表示

@ -1,16 +1,16 @@
<?php
$title = 'アップロード';
$sitedesc = 'アップロードです。';
$siteurl .= '/upload';
$childview = '../ui/upload/index.php';
$title = "アップロード";
$sitedesc = "アップロードです。";
$siteurl .= "/upload";
$childview = "../ui/upload/index.php";
if (isset($_FILES['file'])) {
//dd($_FILES['file']);
//dd(fileextension($_FILES['file']['name'][0]));
//dd(humanreadablesize($_FILES['file']['size'][0]));
//dd(getmimetype('egaokero.png')); // 存在する
//dd(getmimetype('klsdhnjkfjlsdjhnvgf.png')); // 存在しない
if (isset($_FILES["file"])) {
//dd($_FILES["file"]);
//dd(fileextension($_FILES["file"]["name"][0]));
//dd(humanreadablesize($_FILES["file"]["size"][0]));
//dd(getmimetype("egaokero.png")); // 存在する
//dd(getmimetype("klsdhnjkfjlsdjhnvgf.png")); // 存在しない
//dd(verifyupload());
dd(loliupload($_FILES['file']));
dd(loliupload($_FILES["file"]));
}
?>

ファイルの表示

@ -6,8 +6,8 @@ Please enter "mysecurepassword".<br />
</form>
<?php
if (isset($_POST['password'])) {
echo '創作したパスワード(plaintext→sha256+pepper→md5→Argon2id) '.$setpasswd.'<br />';
echo 'ポスワードは「mysecurepassword」ですか?'.(verifypasswd('mysecurepassword', $setpasswd) ? 'はい' : 'いいえ');
if (isset($_POST["password"])) {
echo "創作したパスワード(plaintext→sha256+pepper→md5→Argon2id) ".$setpasswd."<br />";
echo "ポスワードは「mysecurepassword」ですか?".(verifypasswd("mysecurepassword", $setpasswd) ? "はい" : "いいえ");
}
?>

ファイルの表示

@ -2,7 +2,7 @@
<h1>例の一覧</h1>
<ul>
<?php
$scan = array_diff(scandir('../ui'), ['..', '.']);
$scan = array_diff(scandir("../ui"), ["..", "."]);
foreach ($scan as $s) {
?>