Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script src="./jquery.js"></script>
- <script type="text/javascript" src="./jquery.base64.min.js"></script>
- </head>
- <body>
- <form method="POST" class="login-form" action="">
- <input type="text" name="email">
- <br>
- <input type="password" name="password">
- <br>
- <button type="submit" class="submit" name="submit">Login</button>
- </form>
- <?php
- if (isset($_POST) && !empty($_POST)) {
- echo '<pre>';
- print_r($_POST);
- echo '</pre>';
- echo 'Encrypted Password- ' . $_POST['password'];
- echo '<br/>';
- echo 'Password- ' . base64_decode($_POST['password']);
- }
- ?>
- <script type="text/javascript">
- $(document).ready(function() {
- $('button.submit').on('click', function(e) {
- var form = $(this).parents('form');
- var passwordField = $(form).find('input[type="password"]');
- var password = $(passwordField).val();
- var encPassword = $.base64.encode(password);
- $(passwordField).val(encPassword);
- });
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment