Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5.  
  6.  
  7. <form method="post" action="">
  8.  
  9. <input type="username" name="username" placeholder="Enter email" /> <br>
  10.  
  11. <input type="password" name="password" placeholder="Enter Password" />
  12.  
  13. <button type="submit" name="submit">LOG IN</button>
  14. </form>
  15.  
  16.  
  17. <?php
  18. if(isset($_POST['submit']))
  19. {
  20. $username = (isset($_POST['username']) ? $_POST['username'] : '');
  21. $password = (isset($_POST['password']) ? $_POST['password'] : '');
  22.  
  23. $encrypted = encryptIt( $password );
  24. $decrypted = decryptIt( $encrypted );
  25.  
  26. echo $encrypted . '<br />' . $decrypted;
  27.  
  28. function encryptIt( $q ) {
  29. $cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
  30. $qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );
  31. return( $qEncoded );
  32. }
  33.  
  34. function decryptIt( $q ) {
  35. $cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
  36. $qDecoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "");
  37. return( $qDecoded );
  38. }
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement