The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Looking for a safe and efficient way to "carry" data from page to page
Is there a way for me to "carry" a chunk of information around from one screen to another without using cookies?
For example, let's say I have a table that has a questions for a survey I want people to take. If I want the people to answer the questions one at a time and not all on the same page with a single click, can I query the database once and get all the questions and then use that info to show the first question, get a response, show the second question, etc.? What I am trying to avoid is having to query for the first question, get the response, query for the second question, etc. Amy |
#2
|
|||
|
|||
You could put all in an array and post that in a hidden field. Security on this would be a different mather.
|
#3
|
|||
|
|||
Quote:
like question.php?ask=question1 question.php?ask=question2 question.php?ask=question3 ... or im wrong :/ |
#4
|
||||
|
||||
You could extend the session table.
|
#5
|
||||
|
||||
couldn't you serialize the data to scramble it? and then carry it all in a hidden form field?
i.e. PHP Code:
HTML Code:
<input type="hidden" name="questions" value="$answers" />
|
#6
|
||||
|
||||
No matter if you carry the data by hidden fields, cookies or within the URL:
It can be modified by the user. To prevent this you would have to hash the data with some secret to make sure it has not been modified. |
#7
|
||||
|
||||
Personally i think Kirby's way is the best
add a field to the sessions table and there put in the serialized data of the already answered question. |
#8
|
||||
|
||||
Hmm sessions are ideal for carrying answers to survey questions across pages. The only other way I'd do it is serializing the $_POST info as sabe pointed out But if people want to cheat they can cheat. It's a sacrifice you have to make
|
#9
|
||||
|
||||
Thanks for all the ideas, guys.
|
#10
|
||||
|
||||
Efficiency question: What would use more server resources - doing a query for each question, or doing a file read for each question? In general, are file reads more intensive than querying the database?
Amy |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|