Guest User

Untitled

a guest
Apr 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2.  
  3. $dbhost = 'localhost';
  4. $dbuser = 'root';
  5. $dbpass = '';
  6. $db = 'base64';
  7.  
  8. $dbconn = mysql_connect($dbhost, $dbuser, $dbpass);
  9. mysql_select_db($db);
  10. ?>
  11. <!DOCTYPE html>
  12. <html>
  13. <head>
  14. <title>Base64 Encoder and Decoder</title>
  15. </head>
  16. <body>
  17. <div class="spinner"></div>
  18. <div class="template">
  19. <h1>Base 64 Encoder</h1>
  20. <form method="POST" action="#">
  21. <input type="text" name="encode">
  22. <input type="submit" name="encodebtn">
  23. </form>
  24. </body>
  25. </html>
  26. <br><br>
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30. <title>Base64 Encoder and Decoder</title>
  31. <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
  32. </head>
  33. <body>
  34. <h1>Base 64 Decoder</h1>
  35. <form method="POST" action="#">
  36. <input type="text" name="decode">
  37. <input type="submit" name="decodebtn">
  38. </form>
  39. </div>
  40. </body>
  41. </html>
  42. <br><br>
  43. <div class="panel panel-primary">
  44. <div class="panel-heading">
  45. Result
  46. </div>
  47. <div class="panel-body">
  48. <?php
  49. if (isset($_POST['decodebtn'])) {
  50. $text = $_POST['decode'];
  51. $decodehash = base64_decode($text);
  52. $encodehash = base64_encode($text);
  53. echo "Decoded Successfully: " . $decodehash;
  54. $query = ("INSERT INTO hashes (Encoded, Decoded) VALUES ('$encodehash', '$decodehash')");
  55. }
  56. if (isset($_POST['encodebtn'])) {
  57. $text = $_POST['encode'];
  58. $encodehash = base64_encode($text);
  59. $decodehash = base64_decode($text);
  60. echo "Encoded Successfully: " . $encodehash;
  61.  
  62. }
  63.  
  64. ?>
  65. </div>
  66. </div>
  67. </div>
  68. <style>
  69. .panel {
  70. margin-bottom: 20px;
  71. background-color: #fff;
  72. border: 1px solid transparent;
  73. border-radius: 0px;
  74. -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.05);
  75. width: 40%;
  76. }
  77. .panel-primary {
  78. border-color: lightgreen !important;
  79. }
  80. .panel-heading {
  81. background: lightgreen !important;
  82. }
Add Comment
Please, Sign In to add comment