Jump to content


Photo

Is There A Way To Add Variable To The Session Data


  • Please log in to reply
2 replies to this topic

#1 PaulD

PaulD

    Likes Etomite Forums!

  • Developers
  • PipPip
  • 413 posts

Posted 21 July 2012 - 12:06 AM

Hi

I have just written a contact form but it is still not particularly secure. I want to add a variable to the form that gets checked against the session data so that I am sure the request has actually come from a page on my site.

Is there a way to add data to the session in that manner?

The only alternative I can think of is to create a new table and write the variable to the table, but that seems a lot of work, deleting all the old entries etc and seems more efficient to add it to the session data.

This may not be the right way to go about this but without it I don't want to post the snippet to the library.

I only really learned about this using codeigniter, where it kindly takes care of doing all that for you, adding the hidden fields and the session data and checking it automatically - which has proved very handy.

Thanks in advance,

Paul.

#2 -Ed-

-Ed-

    Likes Etomite Forums!

  • Developers
  • PipPip
  • 220 posts

Posted 07 August 2012 - 08:00 AM

Hi Paul,

Sorry for the late responce, am in Denmsrk for vacation :)

I think there should be a way you can get the session number.
that way you should be able to se a hidden imput parameter with the session number.

I have to think about the session check though, but that should not be to complicated, if you can be sure the serverside can read the session to, and know what sessions it has running.

Still could be tricky :)

#3 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 07 August 2012 - 12:59 PM

You can add any data you want too the session object... I save and retrieve data to|from sessions all the time... I even have a pair of class functions that can store and retrieve form "state" which I use on more complex pages...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users