Esempio n. 1
0
//if(strlen( $src ) <= 3 || strlen($family) <= 3) {
if (strlen($src) <= 3) {
    $msg_alerta = "Nada selecionado";
    $_SESSION['msg_alerta'] = $msg_alerta;
    session_write_close();
    header("Location: index.php");
    return;
}
// Add the official family name to array (not the one in the occurrence)
$family_spp = array();
if (is_array(json_decode($family))) {
    $family = json_decode($family);
    $name = $src;
    $spp = array();
    foreach ($family as $family_item) {
        $spp_fam = get_species($src, $family_item);
        $spp = array_merge($spp, $spp_fam);
        $family_array = array_fill(0, sizeof($spp_fam), $family_item);
        $family_spp = array_merge($family_spp, $family_array);
    }
} elseif (is_array(json_decode($spp))) {
    $spp = json_decode($spp);
    $family_spp = array_fill(0, sizeof($spp), $family);
    $name = $family;
} else {
    $name = $family . "_" . $spp;
    $spp = array($spp);
    array_push($family_spp, $family);
}
$name = str_replace(" ", "_", str_replace("-", "_", $name));
$data = [];
Esempio n. 2
0
<?php

include 'get_species.php';
$db = trim($_GET["db"]);
$family = trim($_GET["family"]);
$names = get_species($db, $family);
header("Content-Type: application/json");
echo json_encode($names);