Advertisement
anticims19

ctrlSimpleQuery.php

May 9th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. public function simpleQuery()
  2.     {
  3.         $pesan =  $this->input->post('kata');
  4.         // $pesan = "DELETE FROM TESTING";
  5.         if(!empty($pesan)){
  6.             helper_log("query", $pesan);
  7.  
  8.             if ($this->filterKata($pesan)) {
  9.                 echo $hasil = "Maaf script yang anda masukkan salah/tidak dibolehkan";
  10.             }else{
  11.                 $cari = $this->app_model->simpleQuery($pesan);
  12.                 $details = array_values($cari->result());
  13.                
  14.  
  15.                 $data = array('sample' => $details,  
  16.                 );
  17.  
  18.                 $this->load->view('table/simpleQuery', $data);
  19.                
  20.             }
  21.         }else{
  22.             echo "silahkan masukkan query anda.";
  23.         }
  24.     }
  25.  
  26.     public function filterKata($kata)
  27.     {
  28.         $filter = array("DELETE","DROP","TRUNCATE", "INSERT", "UPDATE");
  29.  
  30.         $hasil = 0;
  31.          
  32.         $jml_kata = count($filter);
  33.          
  34.         for ($i=0;$i<$jml_kata;$i++)
  35.          
  36.         {
  37.          
  38.         if (stristr($kata,$filter[$i]))
  39.          
  40.         { $hasil=1; }
  41.          
  42.         }
  43.          
  44.         return $hasil;
  45.          
  46.        
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement