diff --git a/samples/website_integration/form.php b/samples/website_integration/form.php index 120d4287..5f2985cb 100644 --- a/samples/website_integration/form.php +++ b/samples/website_integration/form.php @@ -17,19 +17,19 @@ $pass = get_from_post_or_empty('password'); $was_successful = false; if ($user && $pass) { - require_once('integration.php'); - if (authme_check_password($user, $pass)) { - printf('

Hello, %s!

', htmlspecialchars($user)); - echo 'Successful login. Nice to have you back!' - . '
Back to form'; - $was_successful = true; - } else { - echo '

Error

Invalid username or password.'; - } + require_once('integration.php'); + if (authme_check_password($user, $pass)) { + printf('

Hello, %s!

', htmlspecialchars($user)); + echo 'Successful login. Nice to have you back!' + . '
Back to form'; + $was_successful = true; + } else { + echo '

Error

Invalid username or password.'; + } } if (!$was_successful) { - echo '

Login sample

+ echo '

Login sample

This is a demo form for AuthMe website integration. Enter your AuthMe login details into the following form to test it.
@@ -42,9 +42,9 @@ into the following form to test it. } function get_from_post_or_empty($index_name) { - return trim( - filter_input(INPUT_POST, $index_name, FILTER_UNSAFE_RAW, FILTER_REQUIRE_SCALAR | FILTER_FLAG_STRIP_LOW) - ?: ''); + return trim( + filter_input(INPUT_POST, $index_name, FILTER_UNSAFE_RAW, FILTER_REQUIRE_SCALAR | FILTER_FLAG_STRIP_LOW) + ?: ''); } ?> diff --git a/samples/website_integration/integration.php b/samples/website_integration/integration.php index 56d51d36..3008fb98 100644 --- a/samples/website_integration/integration.php +++ b/samples/website_integration/integration.php @@ -34,13 +34,13 @@ function authme_check_password($username, $password) { */ function authme_get_hash($username) { // Add here your database host, username, password and database name - $mysqli = new mysqli('HOST', 'USER', 'PWD', 'DB'); - $authme_table = 'authme'; + $mysqli = new mysqli('HOST', 'USER', 'PWD', 'DB'); + $authme_table = 'authme'; - if (mysqli_connect_error()) { - printf('Could not connect to AuthMe database. Errno: %d, error: "%s"', - mysqli_connect_errno(), mysqli_connect_error()); - } else { + if (mysqli_connect_error()) { + printf('Could not connect to AuthMe database. Errno: %d, error: "%s"', + mysqli_connect_errno(), mysqli_connect_error()); + } else { $stmt = $mysqli->prepare("SELECT password FROM $authme_table WHERE username = ?"); $stmt->bind_param('s', $username); $stmt->execute(); @@ -48,7 +48,7 @@ function authme_get_hash($username) { if ($stmt->fetch()) { return $password; } - } + } return null; }