English 中文(简体)
防止隐形形式很容易被 ha
原标题:prevent invisible form from being easily hacked

Summary

如果表格被定在<代码>上:NOe ,其田地有点任意的html>。 用javascript编成的代码,在提交时需要何种数据使/格式安全?

Background

I m 采用JQuery plugin DataTables,对按组别分列的数据进行改造和显示。 除了在 o中一架小型传单外,该表还非常有效:通过TableTools推广结果,其形式是原始格式,而不是分组格式和次表格式。 在discussion with the DataTables/TableTools author之后,我得出结论,我需要以不同方式出口。

我带了一个纽子,把经过修改的表格html而不是原来的表格html提交一个使用mpdf创建的网址。 它通过填写“无形”表格然后提交。 它发挥了巨大作用。

但我担心,如果存在一种看不见的形式,即提出html,那么我就会受到虐待。 有哪些最佳方法可以确保名册上的投入是我期望的投入是任意的?

Code

<!--HTML-->
<button name= Make PDF  id= butPDF />

<form action= makepdf.php  method= post  name= mpdf  
      id= mpdf  style= display:none >
  <textarea name= pdf_html ></textarea>
</form>

//javascript
$(document).ready(function() {
  $( .datatable ).dataTable( {
    //process table into desired format      
  });

  $( button#butPDF ).onClick(
    function(){
       var html= get_my_stuff();//collect up the desired bits
       $( textarea[name="pdf_html"] ).val(html);
       $( form#mpdf).submit();
    }
  );
});

<?php
include(_MPDF_PATH . "mpdf.php");

$html=$_POST[ pdf_html ];
$stylesheet = file_get_contents(LOCAL_INCLUDE. css/mpdf.css );

$mpdf=new mPDF();
$mpdf->WriteHTML($stylesheet,1,true);
$mpdf->WriteHTML($html, 2,false);
$mpdf->Output( myfile.pdf , D ); //D for download
exit;
?>
问题回答

也许增加另一个表格领域,检查是否也填满了。 检查是否在提交后填满,那么,你知道该表是由一位机器人强行填写的。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...