コード例 #1
0
ファイル: account.php プロジェクト: majovec/ServerAuth
        }
        ?>
				<div class='panel' id='chpass'>
				<?php 
        if (isset($_GET["action"]) && strtolower($_GET["action"]) == "chpass" && isset($_POST["old-password"]) && isset($_POST["new-password"]) && isset($_POST["cnew-password"])) {
            if ($api->getPlayerData($_SESSION["login"])["password"] == hash($api->getPasswordHash(), $_POST["old-password"])) {
                $old_password = true;
                if ($_POST["new-password"] == $_POST["cnew-password"]) {
                    if (preg_match('/\\s/', $_POST["new-password"]) == 0) {
                        if (strlen($_POST["new-password"]) <= $config["min-password-length"]) {
                            $new_password = 2;
                        } elseif (strlen($_POST["new-password"]) >= $config["max-password-length"]) {
                            $new_password = 3;
                        } else {
                            $new_password = 4;
                            $api->changePlayerPassword($_SESSION["login"], $_POST["new-password"]);
                        }
                    } else {
                        $new_password = 1;
                    }
                } else {
                    $new_password = 0;
                }
            } else {
                $old_password = false;
            }
        }
        ?>
					<div class='panel-header'>
						<div class='panel-title'><i class='fa fa-key'></i> Change Password</div>
					</div>
コード例 #2
0
ファイル: admin.php プロジェクト: majovec/ServerAuth
                }
            } else {
                echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Can't delete <b>" . $_GET["account"] . "</b>. An error has occurred.</div>";
            }
        }
        if (isset($_GET["action"]) && strtolower($_GET["action"]) == "chuserpass" && isset($_GET["user"]) && isset($_POST["new_password"])) {
            if ($api_status == ServerAuthWebAPI::SUCCESS) {
                if ($api->isPlayerRegistered($_GET["user"])) {
                    if (preg_match('/\\s/', $_POST["new_password"]) == 0) {
                        if (strlen($_POST["new_password"]) <= $config["min-password-length"]) {
                            echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Password for <b>" . $_GET["user"] . "</b> account too short!</div>";
                        } elseif (strlen($_POST["new_password"]) >= $config["max-password-length"]) {
                            echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Password for <b>" . $_GET["user"] . "</b> account too long!</div>";
                        } else {
                            echo "<div class='alert alert-success square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-info-circle'></i> Password for <b>" . $_GET["user"] . "</b> account changed to <b>" . $_POST["new_password"] . "</b></div>";
                            $api->changePlayerPassword($_GET["user"], $_POST["new_password"]);
                        }
                    } else {
                        echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Password for <b>" . $_GET["user"] . "</b> account can't contain spaces</div>";
                    }
                } else {
                    echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Account <b>" . $_GET["user"] . "</b> not found.</div>";
                }
            } else {
                echo "<div class='alert alert-error square'><button class='close'><span class='fa fa-close'></span></button><i class='fa fa-exclamation-circle'></i> Can't change <b>" . $_GET["user"] . "</b> account password. An error has occurred.</div>";
            }
        }
        ?>
						<div class='panel' id='chpass'>
						<?php 
        if (isset($_GET["action"]) && strtolower($_GET["action"]) == "chpass" && isset($_POST["old-password"]) && isset($_POST["new-password"]) && isset($_POST["cnew-password"])) {