Link to home
Start Free TrialLog in
Avatar of tomjenkins12
tomjenkins12

asked on

cakephp, obfuscate,hash, form ids


I am using cakephp and the form helper

My form looks like this

                 <?= $form->create(info );?>
                <?= $form->input('FirstOwner.fname');?>
                <?= $form->input('FirstOwner.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" /
Avatar of Mark Brady
Mark Brady
Flag of United States of America image

You can hash it by adding the hash command.

$form->MD5(input('FirstOwner.fname'));
Avatar of tomjenkins12
tomjenkins12

ASKER

thanks elvin66

<div class="input text"><label for="7313d9266b516ce2fced1e401b08337f89c84e15">7313d9266b516ce2fced1e401b08337f89c84e15</label><input class="valid" name="data[7313d9266b516ce2fced1e401b08337f89c84e15]" value="" id="7313d9266b516ce2fced1e401b08337f89c84e15" type="text"></div>

Im almost there

two issues
1. label name is now changed when i wanted just the form id changed

2. it now does not enter the results into the db for this filed. any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Mark Brady
Mark Brady
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial