MirazMac

Untitled

Jun 14th, 2021
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1.  
  2.         $blockedQueries = ["query1", "query2"];
  3.  
  4.         array_walk($blockedQueries, 'preg_quote');
  5.  
  6.         $pattern = implode("|", $blockedQueries);
  7.  
  8.         if (preg_match("/{$pattern}/i", $query) === 1) {
  9.             if (is_ajax()) {
  10.                 return json(['redirect' => url_for('site.home')]);
  11.             }
  12.  
  13.             return redirect_to('site.home');
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment