From your problem description, it sounds as though you may plan to base mileage reimbursements (actual money payments) on the data entered and retrieved over some time for the application users. If so, the advice given above needs to be further emphasized – do not use a cookie to store unvarnished information on which money depends.

Firstly, depending on how you encode things, a user could read the cookie and actually change the results, adding more miles or more trips than were originally entered. If you don't have a record somewhere else, whom is to reliably say them nay?

Secondly, as pointed out above, cookies are browser- and client-dependent. What do you plan if cookies are turned off, or the user enters the data at work one time and at home the second? Your script will not have access to both computers at once, so both for an audit trail and for data preservation, you must store the results in some structure at your Web server.

Cookies are useful for quick identification and the display of more-or-less public information. But if money is riding on the data entry, you want to be more sure that the proper person is entering the data. If so, you may have to go to a password scheme or some other method of authentication before you actually allow a user to enter or view personal data.

Consider how amazon.com works. You can see recommendations for purchases based on your cookie setting alone, but the minute you try to see information that should be private, like status of orders, entering an order, or even a history of past orders, you have to have a password to at least at some level verify you are who you say you are.

If in fact cash payments (affecting business expenses and taxes) are involved, you will want a more robust security and storage solution.

Live in the moment

In reply to Re: Storing an array in a cookie... by Speedy
in thread Storing an array in a cookie... by Nacho37

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.