cakephp、混淆、哈希、表单 ID
问题: 我正在使用 cakephp 和表单助手
我的表单看起来像这样
<?= $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(); ?>
html 输出是
<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>
如何混淆/散列 id 名称和 id?
我希望它能产生类似的东西
<div class="input text"><label for="FirstOwnerFname">Fname</
label><input name="5sdf65sf6g56asdf56as" type="text" maxlength="255"
value="" id="asd45a5sd4a5sd45ad" /
Question:
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" /
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
$form->hidden()
、$form->text()
等自行创建元素。然后您就可以控制字段名称。但在保存之前,您需要手动将它们翻译回控制器中。但是……你为什么要这样做?我希望不是默默无闻的安全?
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?