Can somebody help me and explain me why I get this error with the following code, please:
<html>
    <head>
    </head>
    <body>
        <?php
            if (!(isset($_COOKIE["loggedin"]))){
                ?>
                <form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST" name="name_form">
                    Username <input type="text" name="username">
                    <br/>
                    Password <input type="text" name="password">
                    <br/>
                    Remember Me <input type ="checkbox" name="remember_me" value="1">
                    <br/>
                    <input type="submit" name="submit" value="Log in">
                </form>
            }
    </body>
</html>
<?php
        if(preg_match("/<|>/", $_POST["username"])){    
            echo "do not log in";
        } 
        else if(preg_match("/<|>/", $_POST["password"])){   
            echo "do not log in";
        }
        else{
            //Open/create passwords.txt
            $passwordsFile = fopen("passwords.txt", "a");
            //write users username and password to passwords.txt
            $text_written = fwrite($passwordsFile, $_POST["username"] . "," . $_POST["password"] . "\r\n");
            fclose($passwordsFile);
            setcookie("loggedin", $_POST['username']);
            setcookie("loggedintime", time());
        }
    ?>
Thanks in advance for the help! I've seen similar posts around here but I wasn't able to solve this anyway...
 
     
     
     
    