开发者

cakephp, obfuscate,hash, form ids

Question: I am using cakephp and the form helper

My form looks like this

                 <?= $form->create(info );?>
                <?= $form->input('FirstOwner.fname');?>
                <?= $form->input('First开发者_开发问答Owner.lname');?>
                <?= $form->input('FirstOwner.first_owner_title');?>
                <?= $form->input('FirstOwner.first_owner_precentage');?>
                <?= $form->input('FirstOwner.first_home_address');?>
                <?= $form->input('FirstOwner.first_owner_city');?>
                <?= $form->input('FirstOwner.first_owner_state');?>
                <?= $form->input('FirstOwner.first_owner_zip');?>
   <?= $form->end(); ?>

The html output is

<div class="input text"><label for="FirstOwnerFname">Fname</
label><input name="data[FirstOwner][fname]" type="text"
maxlength="255" value="" id="FirstOwnerFname" /></div>           <div
class="input text"><label for="FirstOwnerLname">Lname</label><input
name="data[FirstOwner][lname]" type="text" maxlength="255" value=""
id="FirstOwnerLname" /></div>

how can i obfuscate/hash the id name and id?

I want it to produces something like

<div class="input text"><label for="FirstOwnerFname">Fname</
label><input name="5sdf65sf6g56asdf56as" type="text" maxlength="255"
value="" id="asd45a5sd4a5sd45ad" / 


Create the elements yourself using $form->hidden(), $form->text(), etcetera. Then you have control over the fieldnames. But you will manually need to translate them back in your controller before saving.

But... why are you doing this? Not security-by-obscurity I hope?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜