On Nov 28, 2007, at 12:52 PM, Stut wrote:
Jason Pruim wrote:
The search results arn't stored in a session, just the search
variable (IE: What they searched for) It was the only way I could
get it to export the search results to my excel file... It may be
because I have everything in separate files that I'm running into
issues...(The main page is a separate file, as well as the edit,
add, export, & search pages) I think I need to understand more
about programming basics to figure out how to put it all in 1 file
and have it work...
Sticking it all into the same file won't help. You need to think
about data between requests not between pages.
This is exactly the sort of thing where a session is overkill. The
search variable is not sensitive data, there's no need to keep it on
the server so it's an ideal candidate for a cookie. If that's all
you're using the session for then you can easily drop the session
(and therefore the session ID cookie) and just store that info in a
cookie.
I tend to group stuff together to minimise the number of cookies,
and if you have anything larger than a short-ish string you need to
keep that on the server, but be sure to consider whether that
information already exists somewhere else (like in the DB) meaning
you can avoid storing it twice.
Remember that data gets sent by the browser with each request, so
keep it relatively small. Also bear in mind that the client (human
or browser) can change the contents of a cookie at any time so you
need to re-validate them on every page request. If you need to
verify the contents of a cookie from request to request you can a)
encrypt it, or b) add a checksum to it.
The only things I'm storing in session variables is the fact that they
are logged in, and the search they are looking for if they search for
someone. session's are a bit heavy weight for that... More reading on
cookies is coming up! Speaking of cookies... I'm hungry :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@xxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php