summaryrefslogtreecommitdiff
path: root/change_passw.php
diff options
context:
space:
mode:
Diffstat (limited to 'change_passw.php')
-rwxr-xr-x[-rw-r--r--]change_passw.php132
1 files changed, 66 insertions, 66 deletions
diff --git a/change_passw.php b/change_passw.php
index 31e0e0d..82db6d3 100644..100755
--- a/change_passw.php
+++ b/change_passw.php
@@ -1,66 +1,66 @@
-<?php
-include_once './includes/Session.php';
-include_once './includes/model/User.php';
-include_once './includes/functions_user.php';
-
-session_start();
-
-if ($_SERVER['REQUEST_METHOD'] == 'POST' and Session::get()->is_signed_in()) {
- $errors = array();
- $user_pass = "";
-
- if (empty($_POST['user_pass'])) {
- $errors[] = "You must provide a password.";
- } else {
- $user_pass = $_POST['user_pass'];
- $pass_check = $_POST['user_pass_check'];
-
- if (preg_match("/^[a-zA-Z0-9\W]*$/", $user_pass) === false) {
- $errors[] = "Password contains invalid characters!";
- }
-
- if ($user_pass !== $pass_check) {
- $errors[] = "The two passwords do not match.";
- }
- }
-
- if (!empty($errors)) {
- echo 'Please check the following problems: <ul>';
- foreach ($errors as $err) {
- echo '<li>' . $err . '</li>';
- }
- echo '</ul>';
- } else {
- $pass_hash = password_hash($user_pass, PASSWORD_DEFAULT);
- change_password(Session::get()->get_current_user(), $pass_hash);
- echo 'Password successfully changed!';
- }
-}
-?>
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <title>Change your password - cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
-<?php
-include_once './includes/templates/header.php';
-
-if (!Session::get()->is_signed_in()) {
- echo '<h2>You must be logged in to change your password.</h2>';
-} else {
- echo '
- <h2>Change your password</h2>
- <form action="change_passw.php" method="post">
- <label for="user_pass">Password: </label><br>
- <input type="password" name="user_pass"><br>
- <label for="user_pass_check">Re-enter password: </label><br>
- <input type="password" name="user_pass_check"><br>
- <input type="submit" name="submit">
- </form>
- <br>';
-}
-?>
-</body>
-</html>
+<?php
+include_once './includes/Session.php';
+include_once './includes/model/User.php';
+include_once './includes/functions_user.php';
+
+session_start();
+
+if ($_SERVER['REQUEST_METHOD'] == 'POST' and Session::get()->is_signed_in()) {
+ $errors = array();
+ $user_pass = "";
+
+ if (empty($_POST['user_pass'])) {
+ $errors[] = "You must provide a password.";
+ } else {
+ $user_pass = $_POST['user_pass'];
+ $pass_check = $_POST['user_pass_check'];
+
+ if (preg_match("/^[a-zA-Z0-9\W]*$/", $user_pass) === false) {
+ $errors[] = "Password contains invalid characters!";
+ }
+
+ if ($user_pass !== $pass_check) {
+ $errors[] = "The two passwords do not match.";
+ }
+ }
+
+ if (!empty($errors)) {
+ echo 'Please check the following problems: <ul>';
+ foreach ($errors as $err) {
+ echo '<li>' . $err . '</li>';
+ }
+ echo '</ul>';
+ } else {
+ $pass_hash = password_hash($user_pass, PASSWORD_DEFAULT);
+ change_password(Session::get()->get_current_user(), $pass_hash);
+ echo 'Password successfully changed!';
+ }
+}
+?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Change your password - cflip.net forum</title>
+ <link rel="stylesheet" href="styles/style.css">
+</head>
+<body>
+<?php
+include_once './includes/templates/header.php';
+
+if (!Session::get()->is_signed_in()) {
+ echo '<h2>You must be logged in to change your password.</h2>';
+} else {
+ echo '
+ <h2>Change your password</h2>
+ <form action="change_passw.php" method="post">
+ <label for="user_pass">Password: </label><br>
+ <input type="password" name="user_pass"><br>
+ <label for="user_pass_check">Re-enter password: </label><br>
+ <input type="password" name="user_pass_check"><br>
+ <input type="submit" name="submit">
+ </form>
+ <br>';
+}
+?>
+</body>
+</html>