You can put code in your messages, but be sure to also format it as code. You can use HTML to format your posts (along with BBCode and Markdown), so if you just dump HTML in the message box, the forum will try to parse it for formatting.
As for your question itself:
Please note that on our hosting (and most PHP installations) only files with the .php extension are executed as PHP code. If you put PHP code in a file with the .html extension, the code won’t be executed and is just sent to the browser. If you rename the file to login.php, the PHP code will be executed.
If you want the URL to have the .html extension because you think it’s prettier, you can use .htaccess rules to direct a request to file.html to the script file.php.