Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2.  
  3.         header("Cache-Control: no-store, no-cache, must-revalidate");
  4.         header("Cache-Control: post-check=0, pre-check=0", false);
  5.  
  6.         require_once '../../../../conf.php';
  7.         require_once $_root_dir . 'db.php';
  8.         require_once $_root_dir . 'includes/functions.php';
  9.         require_once $_root_dir . 'includes/template.php';
  10.  
  11.         //print_r($_POST);
  12.  
  13.         if (!isset($_SESSION['status']) || $_SESSION['status'] != "login" || $_SESSION['ip'] != $_ip)
  14.                 return -1;
  15.  
  16.         $folder = $_POST['folder'];
  17.         $page = $_POST['page'];
  18.         $query = (isset($_POST['query']) ? addslashes($_POST['query']) : '');
  19.  
  20.         $contacts = NULL;
  21.  
  22.         $sql = "select * from contacts " .
  23.                 "where name like '%{$query}%' or surename like '%{$query}%' or company like '%{$query}%' or phone1 like '%{$query}%' limit 10";
  24.         if (($result = $db->sql_query($sql)) && $db->sql_numrows($result) > 0) {
  25.                 $contacts = $db->sql_fetchrowset($result);
  26.         }
  27.  
  28.         $params = array(
  29.                 'contacts' => $contacts
  30.         );
  31.  
  32.         echo json_encode($params);
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement