1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-04 19:14:41 +00:00

uwuzu v1.6.7 Hapuego

This commit is contained in:
だいちまる
2025-12-26 12:12:47 +09:00
parent 2b107acc17
commit 0666b6b2c4
23 changed files with 349 additions and 204 deletions
+6
View File
@@ -24,6 +24,12 @@ if(!($is_login === false)){
exit;
}
//-------------------------------------------------------------
if(isset($_SESSION['auth_status'])){
if($_SESSION['auth_status'] === "go_recovery"){
header("Location: startrecovery.php");
exit;
}
}
?>
<!DOCTYPE html>
+14
View File
@@ -24,6 +24,20 @@ if(!($is_login === false)){
exit;
}
//-------------------------------------------------------------
if(isset($_SESSION['auth_status'])){
if(!($_SESSION['auth_status'] === "done_recovery")){
if($_SESSION['auth_status'] === "bad_recovery"){
$_SESSION = array();
header("Location: badrecovery.php");
exit;
}else{
$_SESSION = array();
header("Location: index.php");
exit;
}
}
}
?>
<!DOCTYPE html>
+29 -10
View File
@@ -73,6 +73,10 @@ if(!($is_login === false)){
header("Location: ../home/");
exit;
}
//パスワード試行回数制限-------------------------------------------
if (!isset($_SESSION['login_passtry'])) {
$_SESSION['login_passtry'] = 0;
}
//-------------------------------------------------------------
if( !empty($_POST['btn_submit']) ) {
@@ -153,10 +157,6 @@ if( !empty($_POST['btn_submit']) ) {
// SQL実行
$result->execute();
// ... (前略)
// IDの入力チェック
if( empty($userid) ) {
$error_message[] = 'ユーザーIDを入力してください。(USERID_INPUT_PLEASE)';
} else {
@@ -167,6 +167,21 @@ if( !empty($_POST['btn_submit']) ) {
if(!(preg_match("/^[a-zA-Z0-9_]+$/", $userid))){
$error_message[] = "IDは半角英数字で入力してください。(「_」は使用可能です。)(USERID_DONT_USE_WORD)";
}
if ($_SESSION["login_passtry"] <= 5) {
$delay = $_SESSION["login_passtry"] * 2;
} else {
$delay = min(pow(2, $_SESSION["login_passtry"] - 2), 60);
}
sleep($delay);
$locknow_loginLog = isUserLockedByloginLog($pdo, $userid, $_SERVER['REMOTE_ADDR']);
if($locknow_loginLog[0] === true){
$_SESSION["login_passtry"]++;
addloginLog($pdo, $userid, $_SERVER['REMOTE_ADDR']);
$error_message[] = '現在あなたのアカウントは保護のためロックされています。しばらく時間を開けてから再度お試しください。';
}
if(empty($error_message)){
if($result->rowCount() > 0) {
$row = $result->fetch(); // ここでデータベースから取得した値を $row に代入する
@@ -184,40 +199,44 @@ if( !empty($_POST['btn_submit']) ) {
if(MAIL_CHKS == "true"){
$_SESSION['userid'] = $userid;
$_SESSION['mailadds'] = $dec_mailadds;
$_SESSION['auth_status'] = 'go_recovery';
$url = 'startrecovery.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
}
if(empty($row["authcode"])){
$_SESSION['userid'] = "";
$_SESSION['auth_status'] = 'bad_recovery';
$url = 'badrecovery.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}else{
$_SESSION['userid'] = $userid;
$_SESSION['mailadds'] = $dec_mailadds;
$_SESSION['auth_status'] = 'go_recovery';
$url = 'startrecovery.php';
header('Location: ' . $url, true, 303);
// すべての出力を終了
exit;
}
}
else{
}else{
$_SESSION["login_passtry"]++;
addloginLog($pdo, $userid, $_SERVER['REMOTE_ADDR']);
$error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)';
}
}else{
$_SESSION["login_passtry"]++;
addloginLog($pdo, $userid, $_SERVER['REMOTE_ADDR']);
$error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)';
}
}
else {
$_SESSION["login_passtry"]++;
addloginLog($pdo, $userid, $_SERVER['REMOTE_ADDR']);
$error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)';
}
}
+24 -1
View File
@@ -73,6 +73,25 @@ if(!($is_login === false)){
//-------------------------------------------------------------
if(!($userid == null)){
if($_SESSION['auth_status'] === "go_recovery"){
$userData = getUserData($pdo, $_SESSION['userid']);
if(!(empty($userData))){
$userid = $userData["userid"];
}else{
$_SESSION = array();
header("Location: badrecovery.php");
exit;
}
}elseif($_SESSION['auth_status'] === "bad_recovery"){
$_SESSION = array();
header("Location: badrecovery.php");
exit;
}else{
$_SESSION = array();
header("Location: badrecovery.php");
exit;
}
if( !empty($_SESSION['mailadds']) ) {
$result = $pdo->prepare("SELECT userid, username, mailadds, loginid, authcode, encryption_ivkey, datetime FROM account WHERE userid = :userid");
$result->bindValue(':userid', $userid);
@@ -157,6 +176,7 @@ if(!($userid == null)){
send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others", "system");
$_SESSION['userid'] = "";
$_SESSION['auth_status'] = 'done_recovery';
$url = 'donerecovery.php';
header('Location: ' . $url, true, 303);
@@ -258,6 +278,7 @@ if(!($userid == null)){
send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others", "system");
$_SESSION['userid'] = "";
$_SESSION['auth_status'] = 'done_recovery';
$url = 'donerecovery.php';
header('Location: ' . $url, true, 303);
@@ -306,6 +327,7 @@ if(!($userid == null)){
}else{
$_SESSION['mailadds'] = "";
$_SESSION['userid'] = "";
$_SESSION['auth_status'] = 'bad_recovery';
$url = 'badrecovery.php';
header('Location: ' . $url, true, 303);
exit;
@@ -346,7 +368,8 @@ $pdo = null;
<div class="textbox">
<h1>二段階認証</h1>
<p>二段階認証コードと新しいパスワードを入力してください。</p>
<p>二段階認証コードと新しいパスワードを入力してください。<br>メールで認証することも可能です。</p>
<div class="p2">二段階認証コードを設定していない場合、メールで認証をしてください。</div>
<?php if( !empty($error_message) ): ?>
<ul class="errmsg">