Error using php class in html

0

I have a problem when using a PHP class in an html

The class code to use it is this:

<form method="POST">
  <textarea id="imputText" placeholder="Plain or encrypted text here" 
    name="imputText" rows="5" class="input-block-level"></textarea>
  <br>
  <input autocomplete="off" placeholder="Key of the encryption" 
    class="input-block-level input-large" type="imputKey" 
    name="imputKey" value="" id="imputKey">
  <br>

  <select name="blockSize">
    <option value="128">128 Bit</option>            
    <option value="192">192 Bit</option>
    <option value="256">256 Bit</option>
  </select>
  <br>

  <button type="submit" name="direction1" 
    value="Decrypt" class="btn pull-right btn-inverse btn-small">Decrypt</button>
  <button type="submit" name="direction2" 
    value="Encrypt" class="btn pull-right btn-primary btn-small">Encrypt</button>
</form>

<form style="display: none" id="outForm" 
  target="_blank" action="/AES.php" name="out" method="post">
</form>

<?php

if ($_POST['direction2'])
{

  include 'AES.php';
  $imputText = $_POST['imputText'];
  $imputKey = $_POST['imputKey'];
  $blockSize = $_POST['blockSize'];
  $aes = new AES($imputText, $imputKey, $blockSize);

  $enc = $aes->encrypt();
  $aes->setData($enc);
  $dec=$aes->decrypt();
  echo "Encriptado: ".$enc."<br/>";
  echo "Original: ".$dec."<br/>";
}
else if($_POST['direction1'])
{

  include 'AES.php';
  $imputText = $_POST['imputText'];
  $imputKey = $_POST['imputKey'];
  $blockSize = $_POST['blockSize'];
  $aes = new AES($imputText, $imputKey, $blockSize);

  $enc = $aes->encrypt();
  $aes->setData($enc);
  $dec=$aes->decrypt();
  echo "Original: ".$dec."<br/>";

  $enc = $aes->decrypt();
  $aes->setData($enc);
  $dec=$aes->decrypt();
  echo "Desencriptado: ".$dec."<br/>";

}
?>

That used in a .php works but if I want to move it to an .html with this code:

<!DOCTYPE html>

<html lang="es">
<head><title>Privacidad AES</title></head>
<body>
  <article>

    <form method="POST">
      <textarea id="imputText" placeholder="Plain or encrypted text here" 
        name="imputText" rows="5" class="input-block-level"></textarea>
      <br>
      <input autocomplete="off" placeholder="Key of the encryption" 
        class="input-block-level input-large" type="imputKey" 
        name="imputKey" value="" id="imputKey">
      <br>

      <select name="blockSize">
        <option value="128">128 Bit</option>            
        <option value="192">192 Bit</option>
        <option value="256">256 Bit</option>
      </select>
      <br>

      <button type="submit" name="direction1" value="Decrypt" 
        class="btn pull-right btn-inverse btn-small">Decrypt</button>
      <button type="submit" name="direction2" value="Encrypt" 
        class="btn pull-right btn-primary btn-small">Encrypt</button>
    </form>

    <form style="display: none" id="outForm" 
      target="_blank" action="/AES.php" name="out" method="post">
    </form>

    <?php

    if ($_POST['direction2'])
    {

      include 'AES.php';
      $imputText = $_POST['imputText'];
      $imputKey = $_POST['imputKey'];
      $blockSize = $_POST['blockSize'];
      $aes = new AES($imputText, $imputKey, $blockSize);

      $enc = $aes->encrypt();
      $aes->setData($enc);
      $dec=$aes->decrypt();
      echo "Encriptado: ".$enc."<br/>";
      echo "Original: ".$dec."<br/>";
    }
    else if($_POST['direction1'])
    {

      include 'AES.php';
      $imputText = $_POST['imputText'];
      $imputKey = $_POST['imputKey'];
      $blockSize = $_POST['blockSize'];
      $aes = new AES($imputText, $imputKey, $blockSize);

      $enc = $aes->encrypt();
      $aes->setData($enc);
      $dec=$aes->decrypt();
      echo "Original: ".$dec."<br/>";

      $enc = $aes->decrypt();
      $aes->setData($enc);
      $dec=$aes->decrypt();
      echo "Desencriptado: ".$dec."<br/>";

    }
    ?>

  </article>
</body>
</html>

and saving it as an .html ... This appears in my browser:

Then I wonder how I can save the php code inside an html , my purpose is to use css together with html. Thank you very much.

    
asked by Sebastian Hanania 14.04.2017 в 20:19
source

0 answers