Most sane strategies would have you being in control of the original writing of the file. Then you could use a db, or whatever. I'm guessing this is a hotline server news file or the like so you can't do that.

What you can do though is control when you yourself post. If you are on unix flock wouldn't necessarily stop the server from writing to it, but changing permissions might (if it doesn't crash the server). I believe flock on Windows stops all programs from writing to a flocked file but I haven't tried it myself. Anyway lock the file somehow, record the length of the file and the length of your submission, and so on.

You should be able to maintain a file with a list of byte offsets of your own submissions which you could later snip out. If you can't lock maybe you just want to post when the server is down, or something. Maybe you reboot it daily and you can have a script which adds your latest submission to the file at that time.

Otherwise if you just do pattern matching and don't filter other people's submissions they will always be able to fool it.


In reply to Re: Message Board Mangling by mattr
in thread Message Board Mangling by achiles

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.