Skip to content
Permalink
develop
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
header( "Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
require_once 'database.php';
require_once 'person.php';
if( isset( $_REQUEST['do'] ) ){
switch($_REQUEST['do']) {
case "getPerson":
$did = $_GET['id'];
$person = new Person($did);
$data = $person->get();
break;
case 'getAllPeople':
$db = getDatabase();
$query = $db->prepare( "SELECT * from people" );
$query->execute();
$query->setFetchMode( PDO::FETCH_OBJ );
$data = $query->fetchAll();
break;
}
prepareResponse($data);
} else {
die("You need to specify an operation.");
}
function prepareResponse( $arr ) {
echo json_encode( $arr );
}