B
B
Blind-programmer2020-08-21 19:36:47
WordPress
Blind-programmer, 2020-08-21 19:36:47

WordPress throws a critical error, where could I have made a mistake?

Hello everyone, I created a page in the console and created a page-slack.php file in the theme folder? and put the code there

<?php get_header(); ?>
<main id="site-content" role="main">
<form method=post>Генератор паролей
<p class="">вставьте в поле число количества знаков для сгенерируемого пароля </p>
<p>
  <input type=text name=number value="10">
  
  <input type=submit value="Генерировать">
</p>
<p>Сгенерированый пароль:
  
<form>
  
  
<strong>
  <?php

  // Параметр $number - сообщает число 

  // символов в пароле

  echo generate_password($_POST['number']);

  function generate_password($number)

  {

    $arr = array('a','b','c','d','e','f',

                 'g','h','i','j','k','l',

                 'm','n','o','p','r','s',

                 't','u','v','x','y','z',

                 'A','B','C','D','E','F',

                 'G','H','I','J','K','L',

                 'M','N','O','P','R','S',

                 'T','U','V','X','Y','Z',

                 '1','2','3','4','5','6',

                 '7','8','9','0'				           '!','_','@','#','$','^','&','*','(',')','+',';','?');

    // Генерируем пароль

    $pass = "";

    for($i = 0; $i < $number; $i++)

    {

      // Вычисляем случайный индекс массива

      $index = rand(0, count($arr) - 1);

      $pass .= $arr[$index];

    }

    return $pass;

  }

?>
</strong></p>
  <table width="17%" bordercolor="%">
    <tr>
      <td></td>
    </tr>
  </table>
</main><!-- #site-content -->
<?php get_footer(); ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-08-21
@Blind-programmer

You have at least 2 errors there ...
1)
'0' '!','_','@'
there is not enough comma
2)

<input type=submit value="Генерировать">
</p>
<p>Сгенерированый пароль:
  
<form>

This part of the code is weird too. Because the tag is not closed.
In general, debug the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question