Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

cakephp, obfuscate,hash, form ids

Posted on 2011-03-14
3
Medium Priority
?
585 Views
Last Modified: 2013-12-13

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" /
0
Comment
Question by:tomjenkins12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35134121
You can hash it by adding the hash command.

$form->MD5(input('FirstOwner.fname'));
0
 

Author Comment

by:tomjenkins12
ID: 35139478
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?
0
 
LVL 20

Accepted Solution

by:
Mark Brady earned 2000 total points
ID: 35141898
Try moving the MD5 command around a bit, put it right before the input name= part. like this

$form->input(MD5('FirstOwner.fname'));
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question