mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
Add files via upload
This commit is contained in:
@@ -42,58 +42,15 @@ try {
|
||||
// 接続エラーのときエラー内容を取得する
|
||||
$error_message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', $_SESSION['userid']);
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
if(empty($res["userid"])){
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}elseif($_SESSION['loginid'] === $res["loginid"]){
|
||||
// セッションに値をセット
|
||||
$userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
|
||||
$username = $_SESSION['username']; // セッションに格納されている値をそのままセット
|
||||
$_SESSION['admin_login'] = true;
|
||||
$_SESSION['userid'] = $userid;
|
||||
$_SESSION['username'] = $username;
|
||||
$_SESSION['loginid'] = $res["loginid"];
|
||||
setcookie('userid', $userid, time() + 60 * 60 * 24 * 14);
|
||||
setcookie('username', $username, time() + 60 * 60 * 24 * 14);
|
||||
setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14);
|
||||
setcookie('admin_login', true, time() + 60 * 60 * 24 * 14);
|
||||
header("Location: home/");
|
||||
header("Location: home/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', $_COOKIE['userid']);
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
if(empty($res["userid"])){
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}elseif($_COOKIE['loginid'] === $res["loginid"]){
|
||||
// セッションに値をセット
|
||||
$userid = $_COOKIE['userid']; // クッキーから取得した値をセット
|
||||
$username = $_COOKIE['username']; // クッキーから取得した値をセット
|
||||
$_SESSION['admin_login'] = true;
|
||||
$_SESSION['userid'] = $userid;
|
||||
$_SESSION['username'] = $username;
|
||||
$_SESSION['loginid'] = $res["loginid"];
|
||||
setcookie('userid', $userid, time() + 60 * 60 * 24 * 14);
|
||||
setcookie('username', $username, time() + 60 * 60 * 24 * 14);
|
||||
setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14);
|
||||
setcookie('admin_login', true, time() + 60 * 60 * 24 * 14);
|
||||
header("Location: home/");
|
||||
header("Location: home/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -229,7 +186,7 @@ $pdo = null;
|
||||
<!--アカウント関連-->
|
||||
<div>
|
||||
<label for="password">パスワード</label>
|
||||
<input onInput="checkForm(this)" id="password" class="inbox" type="password" name="password" value="<?php if( !empty($_SESSION['password']) ){ echo htmlentities( $_SESSION['password'], ENT_QUOTES, 'UTF-8'); } ?>">
|
||||
<input onInput="checkForm(this)" id="password" class="inbox" type="password" name="password" maxlength="32" value="<?php if( !empty($_SESSION['password']) ){ echo htmlentities( $_SESSION['password'], ENT_QUOTES, 'UTF-8'); } ?>">
|
||||
</div>
|
||||
|
||||
<input type="submit" name="btn_submit" class="irobutton" value="ログイン">
|
||||
|
||||
Reference in New Issue
Block a user