mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 13:08:58 +00:00
Created search controller
This commit is contained in:
parent
238d1a2637
commit
6c35764f48
30
RestControllers/searchController.php
Normal file
30
RestControllers/searchController.php
Normal 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
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user