gaku-ura/hide_php/login.php

49 行
1.2 KiB
PHP

<?php
//直接アクセスしちゃだめ
require $d_root.'/hide_php/conf/c.php';
require $d_root.'/hide_php/conf/submit.php';
require $d_root.'/hide_php/conf/form.php';
session_start();
//定義
if (isset($_GET['Board'])){
$board = (int)$_GET['Board'];
} else {
not_found();
}
if ($board === 0){
not_found();
}
if (isset($_POST['session_num'], $_POST['access_passwd'])){
$url = (isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'unset');
if (check_session('login', $_POST['session_num'], $url, true)){
$_SESSION['login:'.$board] = pass(h($_POST['access_passwd']));
header('Location:./board.php?Board='.$board);
exit;
}
}
$session_num = one_time_pass(50, 100);
set_session('login', $session_num);
######html開始
html_head('ログイン-', '', $d_root.'/sqlike/css/form/bbs.css', false);
echo '<h1>ログイン</h1>';
echo '<form action="" method="POST">
<input type="hidden" name="session_num" value="'.$session_num.'">
<p><label><b>アクセスパスワード</b><input type="text" name="access_passwd"></label><button type="submit" style="background:#eef;padding:.3em;">ログイン</button></p>
</form>';
html_foot('', '');