Created search controller

This commit is contained in:
Pierre 2017-05-27 09:30:54 +02:00
parent 238d1a2637
commit 6c35764f48

View File

@ -0,0 +1,30 @@
<?php
/**
* Search controller
*
* @author Pierre HUBERT
*/
class userController
{
/**
* Peform a research on the database
*
* @url POST /search/request
*/
public function searchDatabase(){
//Check if the query was specified with the request
if(!isset($_POST['query']))
Rest_fatal_error(400, "Please specify search terms");
//Check for search limit
$seachLimit = (isset($_POST['searchLimit']) ? $_POST['searchLimit']*1 : 5);
//Check the limit
if($seachLimit < 1 || $seachLimit > 25)
Rest_fatal_error(401, "Invalid search limit !");
//Perform research on the database and return results
}
}