dongming4994 2012-11-29 11:26
浏览 31

在第8行的\ myform.php中的非对象上调用成员函数escape()

i am making a simple data entry form for wordpress. i have the form submitting to the following bit of php:

//protect your codes from attacks.
 isset($_POST['exporter']) ? $exporter=$wpdb->escape($_POST['exporter']) : $exporter='';
 isset($_POST['importer']) ? $importer=$wpdb->escape($_POST['importer']) : $importer='';
 isset($_POST['conveyance']) ? $conveyance=$wpdb->escape($_POST['conveyance']) : $conveyance='';
 isset($_POST['origin']) ? $origin=$wpdb->escape($_POST['origin']) : $origin='';
 isset($_POST['dpoe']) ? $dpoe=$wpdb->escape($_POST['dpoe']) : $dpoe='';
 isset($_POST['impcon']) ? $impcon=$wpdb->escape($_POST['impcon']) : $impcon='';
 isset($_POST['container']) ? $container=$wpdb->escape($_POST['container']) : $container='';
 isset($_POST['nopk']) ? $nopk=$wpdb->escape($_POST['nopk']) : $nopk='';
 isset($_POST['tyop']) ? $tyop=$wpdb->escape($_POST['tyop']) : $tyop='';
 isset($_POST['name']) ? $name=$wpdb->escape($_POST['name']) : $name='';
 isset($_POST['botname']) ? $botname=$wpdb->escape($_POST['botname']) : $botname='';
 isset($_POST['quantity']) ? $quantity=$wpdb->escape($_POST['quantity']) : $quantity='';
 isset($_POST['certify']) ? $certify=$wpdb->escape($_POST['certify']) : $certify='';
 isset($_POST['declaration']) ? $declaration=$wpdb->escape($_POST['declaration']) : $declaration='';
 isset($_POST['date']) ? $date=$wpdb->escape($_POST['date']) : $date='';
 isset($_POST['treatment']) ? $treatment=$wpdb->escape($_POST['treatment']) : $treatment='';
 isset($_POST['dutemp']) ? $dutemp=$wpdb->escape($_POST['dutemp']) : $dutemp='';
 isset($_POST['concen']) ? $concen=$wpdb->escape($_POST['concen']) : $concen='';
 isset($_POST['adinfo']) ? $adinfo=$wpdb->escape($_POST['adinfo']) : $adinfo='';
 isset($_POST['insname']) ? $insname=$wpdb->escape($_POST['insname']) : $insname='';
 isset($_POST['place']) ? $place=$wpdb->escape($_POST['place']) : $place='';
 isset($_POST['namedesg']) ? $namedesg=$wpdb->escape($_POST['namedesg']) : $namedesg='';
 isset($_POST['dateissue']) ? $dateissue=$wpdb->escape($_POST['dateissue']) : $dateissue='';
if (is_object($wpdb) && is_a($wpdb, 'wpdb')) {
if (!$wpdb->insert('form',

                        array(
                            'consignor'=>$_POST[exporter]
                            ,'consignee'=>$_POST[importer]
                            ,'conveyance'=>$_POST[conveyance]
                .... ?>

any ideas on why i am getting the error?

  • 写回答

2条回答 默认 最新

  • douyonglang4845 2012-11-29 11:31
    关注

    This is because of $wpdb. either call it or one of it's object before using it.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line