I’m trying to setup a custom form in wordpress using a plugin and following these instructions as tutorial: http://code.tutsplus.com/tutorials/creating-a-custom-wordpress-registration-form-plugin–cms-20968 . I’m not trying to create a “register user” plugin, I just take that as an example to create custom forms in wordpress. For my question, I don’t think that using wordpress is relevant, so I’m posting this question in the general section.
Right now I want to handle some security issues.
I’ve an input field of this form who takes the value “name” from my database and display it to the users in a field of the form. Then this “name” is sent again to the database. I don’t want users to be able to modifiy this field. I’ve used “readonly” in my form, but anyone can edit the source of the page and edit that “name”, so this is not that much safe.
What can I do to prevent visitors from editing this field?
If necessary I can use also JavaScript.
I hope it would help you stop passing incorrect edited values
While echoing your form, Make hidden input like this…. with hash_mac
Then at the receiver end, validate the given name with $hmac
if $hamac and and $foo is matching Then no one would have edited your input. Make your “mysecretstring” non guessable.
First of all you leave it as you are doing and then add an extra hidden input field and assign it the value as you gave it to your readonly field and then when you are submitting your form get the value of your hidden input field.I hope it will help.