Jump to content

Question regarding sessions and formdata


effkay

Recommended Posts

Hi.

 

I'm running a questionnaire on the web which consists of a basic html form, a php-script for sending the information, and a mysql database to store the information. To ensure that not everyone can get access to the questionnaire, I added a simple login-script which registers a new session. All subsequent pages after the login-page have "session_start; if !session_is_registered(username) { header(index.html); }. So thats working fine for now. However, I've been working on implementing serverside validation of the formdata and here's where the problem arise. Lets say someone entered a sql-command into a text-field, e.g. "SELECT * FROM $table" and submitted. This input would not validate with my current validation-script, since special characters like * and $ are banned. Ok... So the user now gets a html-page saying "Hey.. you used illegal characters. Go back and try again". When the user goes back, the questionnaire is blank, even though the user got it right on all other questions. Now I thought, since the user registers a new session when he logs in, that the form-data would be stored in that session, and that going back from the validation-error-page would display the questionnaire as the user tried to submit it. Has anyone got an idea as to what I should do?

 

I tested my current script in several browsers. Safari seems to be the only browser that stores the questionnaire, and displays it as it was prior to the error-page when going back.

 

Suggestions are appreciated!

-FK-

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.