Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
<agree monk="AgentM" />

I assume you are familiar with the downside of not using cookies; without a required login by the client you cannot maintain state beyond the current connection. Of course, if you require a login (e.g. "To resume your previous shopping session, please log in!" link), you can get around this.

Managing state is not so bad without cookies, you don't need to store all the cart data on the form in a <input type=hidden> field, but you do have to store a local sessionID in either a <input type=hidden> field or pass it in the query string. Either way, CGI.pm makes it easy to grab that info back from the client.

In order to use the sessionID, I would recommend the DB route, although you can do it using a simple text file on your server. Going the DB route, create a SQL table like this one (of course yours will be different, but this is just an example ;) :

use shopdb; create table sessions ( SessionID int, isComplete bool, SessionData varchar[2000] );

...and then you just post to the DB just like you would have been doing to the cookie.


In reply to Re: Saving State w/o Cookies by Shayk
in thread Saving State w/o Cookies by motomuse

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



  • 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> <u> <ul>
  • 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 intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-03-29 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found