html

<form action="check.php" class="login-form" method="post"> <input name="login" type="text" placeholder="username"/> ... </form> 

check.php

 <?php $login = $_POST['login']; ... $user = "admin/".$login.".txt"; echo file($user)[0]; ?> 

Gives an error message -

Warning: file (admin / .txt): failed to open stream: No such file or directory ...

I thought that maybe $ login does not work, but in the same place changing the last line to

 echo $login; 

It contained what you need. Why then the link does not add up?

  • Use the full file path - Octavian
  • echo "admin /".$ login.". txt ";? - Farkhod Daniyarov
  • @wnull I checked, and changed the variable to the desired word. Everything worked. - AndrewKO322
  • @FarkhodDaniyarov Also in my post it was clear that the link is simply not made. And from what you wrote it turned out - admin / .txt. - AndrewKO322
  • @ AndrewKO322 var_dump($_POST); what gives? - Farkhod Daniyarov

0