Solved

cakephp, obfuscate,hash, form ids

Posted on 2011-03-14
3
562 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xml with php question 5 50
curl parse data from site 20 60
Export Data from MySql Using PHP 16 62
Can't Find the Homepage on my site 4 42
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

734 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