Oh, among other issues, there are security concerns with this code.
- First, the handling of @pairs and $buffer seems to be a leftover from some pre-CGI variation, the %FORM hash is not used in the rest of the code.
- Your code is just appending stuff to the drivers.html file, so this file will probably never be correct HTML - the closing elements are missing.
- As already written by LanX: You accept anything your script gets as parameters and write it to the file. As a harmless example, let a user provide nick=<div style="display:none">. Whatever this user, and all subsequent users, add to the file, will be invisible - until another request happens to close the div element. This is called HTML injection.
- If said script ends with reloading the same page again, then your users are in an endless loop and sooner or later your web server will break.
You should be aware that the URL leading to your script doesn't need to be called by a browser. A malicious user could easily use LWP::UserAgent or a similar module to feed any complicated stuff into your script.
And yes, all these things have happened a lot of times. The OWASP top ten always lists "Injection" as a prominent security risk.
As a minimum security guard you should prevent user-provided HTML from being processed by the browser by using HTML::Entities or HTML::Escape to encode unsafe characters.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.