Login sample This is a demo form for AuthMe website integration. Enter your AuthMe login details into the following form to test it.
Name
Email
Pass
'; } 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) ?: ''); } // Login logic function process_login($user, $pass, AuthMeController $controller) { if ($controller->checkPassword($user, $pass)) { printf('

Hello, %s!

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

Error

Invalid username or password.'; } return false; } // Register logic function process_register($user, $pass, $email, AuthMeController $controller) { if ($controller->isUserRegistered($user)) { echo '

Error

This user already exists.'; } else if (!is_email_valid($email)) { echo '

Error

The supplied email is invalid.'; } else { // Note that we don't validate the password or username at all in this demo... $register_success = $controller->register($user, $pass, $email); if ($register_success) { printf('

Welcome, %s!

Thanks for registering', htmlspecialchars($user)); echo '
Back to form'; return true; } else { echo '

Error

Unfortunately, there was an error during the registration.'; } } return false; } function is_email_valid($email) { return trim($email) === '' ? true // accept no email : filter_var($email, FILTER_VALIDATE_EMAIL); } ?>