";
if($YearTest == "true") { echo "Collection year not valid! Please enter a four-digit year. "; }
if($YearTest2 == "true") { echo "First collection year has to be smaller than the second. "; }
if($CoordinateTest == "true") { echo "Coordinates not valid, comma not permitted! Please enter a decimal coordinate. "; }
if($CoordinateTest2 == "true") { echo "Coordinates not valid. Latitude must no be smaller than -90.0 or bigger than 90.0! "; }
if($CoordinateTest3 == "true") { echo "Coordinates not valid. Longitude must no be smaller than -180.0 or bigger than 180.0! "; }
echo "
"; }
/*******************************************************************************************************
* Suchabfrage für Schlagwortsuche oder Erweiterte Suche *
* *
*******************************************************************************************************/
if($_GET['sqlType'] != "Detail" and !$formSubmitShopDetail and $Error != "true" and ($formSubmitSearch or $_REQUEST['hitlist'] == "true" or $ShopTest == 'true' or $_GET['UnitIDS'] != ""))
{
$tr = "=";
$no = "!=";
$lk = "like";
$bt = ">=";
$st = "<=";
if($_REQUEST['hitlist'] == "true" or $ShopTest == "true")
{$parr = $_COOKIE; }
if($_REQUEST['hitlist'] == "" and $ShopTest != "true")
{$parr = $_POST; }
if($_GET['UnitIDS'] != "" and $_GET['sqlType'] != "Detail")
{$parr = $_GET; }
array($parr);
foreach ($parr as $var)
{
$i ++;
if(preg_match('/[<>]/', $var))
{ $testhtml = true;
echo "
Incorrect character (<,>). Please change your entry!"; }
if($testhtml != true)
{
if(!empty($var) and $var!="Search" and key($parr)!="PHPSESSID" and $var!="test" and $var!="Yes")
{
switch (key($parr))
{
case 'formSearch':
$last = substr($var,-1,1);
$test = strlen($var);
$count = $test-1;
$search = substr($var,0,$count);
if($last == '*' and $test > 1)
{
$str = "(tablecachetaxonidentified.NameAuthorYear ".$lk." '".addslashes($search)."%' OR ";
$str .= "tablecache.UnitID_DNA ".$lk." '".addslashes($search)."%' OR ";
$str .= "tablecache.UnitID_Specimen ".$lk." '".addslashes($search)."%' OR ";
$str .= "tablecache.CountryName ".$lk." '".addslashes($search)."%' OR ";
$str .= "tablecachehighertaxa.Family ".$lk." '".addslashes($search)."%') AND "; }
if($last != '*')
{
$str = "(tablecachetaxonidentified.NameAuthorYear ".$lk." '".addslashes($var)."%' OR ";
$str .= "tablecache.UnitID_DNA ".$lk." '".addslashes($var)."' OR ";
$str .= "tablecache.UnitID_Specimen ".$lk." '".addslashes($var)."' OR ";
$str .= "tablecache.CountryName ".$lk." '".addslashes($var)."' OR ";
$str .= "tablecachehighertaxa.Family ".$lk." '".addslashes($var)."') AND "; }
$description = " Search key = ";
if($_POST['formSearch']) { $value = $formSearch; }
else {$value = $_COOKIE['formSearch']; }
break;
case 'formHigherTaxon':
$str = "tablecachehighertaxa.Family ".$tr." '".addslashes($var)."' AND ";
$description = " Family = ";
if($_POST['formHigherTaxon']) {$value = $formHigherTaxon; }
else {$value = $_COOKIE['formHigherTaxon'];}
break;
case 'formTaxonName':
$last = substr($var,-1,1);
$test = strlen($var);
$count = $test-1;
$search = substr($var,0,$count);
if($last == '*' and $test > 1)
{
$str = "tablecachetaxonidentified.NameAuthorYear ".$lk." '".addslashes($search)."%' AND "; }
if($last != '*')
{
$str = "tablecachetaxonidentified.NameAuthorYear ".$tr." '".addslashes($var)."' AND "; }
$description = " Species = ";
if($_POST['formTaxonName']) {$value = $formTaxonName; }
else {$value = $_COOKIE['formTaxonName'];}
break;
case 'formNCBI':
$str = "tablecachetaxonidentified.Tax_ID_NCBI ".$tr." '".addslashes($var)."' AND ";
$description = " Taxonomy ID (NCBI) = ";
if($_POST['formNCBI']) {$value = $formNCBI; }
else {$value = $_COOKIE['formNCBI'];}
break;
case 'formCountryList':
$str = "tablecache.CountryName ".$tr." '".addslashes($var)."' AND ";
$description = " Country = ";
if($_POST['formCountryList']) {$value = $formCountryList; }
else {$value = $_COOKIE['formCountryList'];}
break;
case 'formContinentList':
$str = "tablecountry_continent.Continent ".$tr." '".addslashes($var)."' AND ";
$description = " Continent = ";
if($_POST['formContinentList']) {$value = $formContinentList; }
else {$value = $_COOKIE['formContinentList'];}
break;
case 'formSeaList':
$str = "tablecache.Seas ".$tr." '".addslashes($var)."' AND ";
$description = " Sea = ";
if($_POST['formSeaList']) {$value = $formSeaList; }
else {$value = $_COOKIE['formSeaList'];}
break;
case 'formOceanList':
$str = "tablecache.Ocean ".$tr." '".addslashes($var)."' AND ";
$description = " Ocean = ";
if($_POST['formOceanList']) {$value = $formOceanList; }
else {$value = $_COOKIE['formOceanList'];}
break;
case 'formLongitudeFrom':
$str = "tablecache.LongitudeDecimal ".$bt." '".addslashes($var)."' AND ";
$description = " Longitude >= ";
if($_POST['formLongitudeFrom']) {$value = $formLongitudeFrom; }
else {$value = $_COOKIE['formLongitudeFrom'];}
break;
case 'formLongitudeTo':
$str = "tablecache.LongitudeDecimal ".$st." '".addslashes($var)."' AND ";
$description = " Longitude <= ";
if($_POST['formLongitudeTo']) {$value = $formLongitudeTo; }
else {$value = $_COOKIE['formLongitudeTo'];}
break;
case 'formLatitudeFrom':
$str = "tablecache.LatitudeDecimal ".$bt." '".addslashes($var)."' AND ";
$description = " Latitude >= ";
if($_POST['formLatitudeFrom']) {$value = $formLatitudeFrom; }
else {$value = $_COOKIE['formLatitudeFrom'];}
break;
case 'formLatitudeTo':
$str = "tablecache.LatitudeDecimal ".$st." '".addslashes($var)."' AND ";
$description = " Latitude <= ";
if($_POST['formLatitudeTo']) {$value = $formLatitudeTo; }
else {$value = $_COOKIE['formLatitudeTo'];}
break;
case 'formYearFrom':
$str = "tablecache.CollectionYear ".$bt." '".addslashes($var)."' AND ";
$description = " Collection Year >= ";
if($_POST['formYearFrom']) {$value = $formYearFrom; }
else {$value = $_COOKIE['formYearFrom'];}
break;
case 'formYearTo':
$str = "tablecache.CollectionYear ".$st." '".addslashes($var)."' AND ";
$description = " Collection Year <= ";
if($_POST['formYearTo']) {$value = $formYearTo; }
else {$value = $_COOKIE['formYearTo'];}
break;
case 'formCollector':
$str = "tablecache.Collector ".$lk." '%".addslashes($var)."%' AND ";
$description = " Collector = ";
if($_POST['formCollector']) {$value = $formCollector; }
else {$value = $_COOKIE['formCollector'];}
break;
case 'formCollectorsNo':
$str = "tablecache.CollectorsNo ".$lk." '%".addslashes($var)."%' AND ";
$description = " Collector's No = ";
if($_POST['formCollectorsNo']) {$value = $formCollectorsNo; }
else {$value = $_COOKIE['formCollectorsNo'];}
break;
case 'formType':
$str = "tablecache.TypeStatus ".$no." '' AND ";
$description = " Type Status = ";
$value = "true";
break;
case 'formImage':
$str = "tablecache.Image_Available ".$tr."'1' AND ";
$description = " Images = ";
$value = "available";
break;
case 'formSpecUnitID':
$str = "tablecache.UnitID_Specimen ".$tr." '".addslashes($var)."' AND ";
$description = " UnitID (Specimen) = ";
if($_POST['formSpecUnitID']) {$value = $formSpecUnitID; }
else {$value = $_COOKIE['formSpecUnitID'];}
break;
case 'formQuality':
$str = "tablecache.DNA_Quality ".$tr." '".addslashes($var)."' AND ";
$description = " DNA Quality = ";
if($_POST['formQuality']) {$value = $formQuality; }
else {$value = $_COOKIE['formQuality'];}
break;
case 'formTissueList':
$str = "tablecache.Tissue ".$tr." '".addslashes($var)."' AND ";
$description = " Tissue = ";
if($_POST['formTissueList']) {$value = $formTissueList; }
else {$value = $_COOKIE['formTissueList'];}
break;
case 'formDnaBankNumber':
$str = "tablecache.UnitID_DNA ".$tr." '".addslashes($var)."' AND ";
$description = " DNA Bank No = ";
if($_POST['formDnaBankNumber']) {$value = $formDnaBankNumber; }
else {$value = $_COOKIE['formDnaBankNumber'];}
break;
case 'formGenBankNumber':
$str = "tablecachegenbanknumbers.GenBankNumber ".$tr." '".addslashes($var)."' AND ";
$description = " GenBank Accession Number = ";
if($_POST['formGenBankNumber']) {$value = $formGenBankNumber; }
else {$value = $_COOKIE['formGenBankNumber'];}
break;
case 'formDNAbank':
$str = "tablecache.ID_Dataset_DNA ".$tr." '".addslashes($var)."' AND ";
$description = " DNA Bank = ";
$result = mysql_query("SELECT InstitutionCode_DNA FROM tablecache WHERE ID_Dataset_DNA ".$tr." '".$var."'");
while($row = mysql_fetch_object($result))
{$value = $row->InstitutionCode_DNA; }
break;
case 'UnitIDS':
$str = "tablecache.UnitID_Specimen ".$tr." '".addslashes($var)."' AND ";
$description = " UnitID Specimen = ";
if($_GET['UnitIDS']) {$value = $_GET['UnitIDS']; }
else {$value = $_COOKIE['UnitIDS'];}
break;
case 'CollCodeS':
$str = "tablecache.CollectionCode_Specimen ".$tr." '".addslashes($var)."' AND ";
$description = " Collection Code Specimen = ";
if($_GET['CollCodeS']) {$value = $_GET['CollCodeS']; }
else {$value = $_COOKIE['CollCodeS'];}
break;
case 'InstCodeS':
$str = "tablecache.InstitutionCode_Specimen ".$tr." '".addslashes($var)."' AND ";
$description = " Institution Code Specimen = ";
if($_GET['InstCodeS']) {$value = $_GET['InstCodeS']; }
else {$value = $_COOKIE['InstCodeS'];}
break;
case 'page':
break;
}
$where[$i] = $str;
$descriptionall[$i] = $description;
$valueall[$i] = $value;
}
next($parr);
}}
if(empty($str))
{
echo "
No hits found for: ";
foreach($descriptionall as $index => $descriptiontest)
{ $valuetest = $valueall[$index];
echo $descriptiontest."[".$valuetest."]"; }
echo ".
";
echo "
Nothing found?
Please note! The query boxes (e.g. species or family name) offer suggestion lists while the search term is being typed. If no list appears, no specimen is available in our DNA or tissue collection.
If you search for DNA of a certain species which is not listed here please contact one of the curators see below. The partner institutions of the network hold major specimen collections. May be on-demand DNA extractions can be made available.
";
}
else
{
if(isset($InstCodeDNA)) {
$sqlType = "Shop";
/*******************************************************************************************************
* Trefferliste für Warenkorb/Bestellung erzeugt *
* Übersicht nach DNA-Banken sortiert, also Bestellungen bei DNA Bank 1, Bestellungen bei DNA Bank 2 *
*******************************************************************************************************/
if(($formSubmitOrder or $formSubmitOrder2) and $sqlType=="Shop")
{
echo "
Your Shopping Cart
";
if(!isset($_COOKIE['test']) or !$_COOKIE['test']) {
echo "Please enable Cookies! Otherwise search will not work properly. ";}
echo "
";
if($formSubmitOrder)
{ echo "Please check your data.";
if($sum > 1) { echo "You will order DNA from ".$sum." different DNA banks"; }
echo " "; }
$sum = sizeof($InstCodeDNA);
echo "
";
if($formSubmitOrder2)
{ echo "
Dear ".$log.".
Thank you very much for your request of DNA samples from the DNA Bank Network.
Your inquiry has been forwarded to the DNA bank(s) in authority of the requested samples. Shortly you will receive an email offer of these DNA bank(s) including binding sample prices and shipping fee(s).
Sincerely,
The DNA Bank Network Team
";
echo "
"; }
foreach ($InstCodeDNA as $InstCode) {
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
// $sql = $sqlcreate .
$sql = "CREATE TEMPORARY TABLE tmpDnaIDs TYPE=HEAP SELECT DISTINCT tablecache.ID_Cache FROM tablecache
LEFT JOIN tablecachetaxonidentified ON tablecache.ID_Cache = tablecachetaxonidentified.ID_Cache
LEFT JOIN tablecachehighertaxa ON tablecachetaxonidentified.ID_TaxonIdentified = tablecachehighertaxa.ID_CacheTaxonidentified
LEFT JOIN tablecachegenbanknumbers ON tablecache.ID_Cache = tablecachegenbanknumbers.ID_Cache
LEFT JOIN tablecountry_continent ON tablecache.ID_Country = tablecountry_continent.ID_Country
LEFT JOIN tablecart ON tablecache.ID_Cache = tablecart.ID_Cache " .
"WHERE tablecart.Session = '$SID' AND tablecart.ID_User = '$UserID' ".
" AND tablecache.InstitutionCode_DNA = '$InstCode' " .
" ORDER BY tablecachetaxonidentified.NameAuthorYear, tablecache.CountryName, LENGTH(tablecache.UnitID_DNA), tablecache.UnitID_DNA ".$sqllimit;
$result = mysql_query($sql);
include("Query-Shop.php");
if($formSubmitOrder2)
{ echo $message;
$test[] = $message;
$mesgDNABank = "
Dear ".$InstitutionCode." DNA Bank. ";
$mesgDNABank .= "The customer ".$Forename." ".$Surname." preconfirmed ".$gesamt." DNA ";
if($gesamt == 1) { $mesgDNABank .= "sample"; }
if($gesamt > 1) { $mesgDNABank .= "samples"; }
$mesgDNABank .= " of your DNA bank. Please check if the ";
if($gesamt == 1) { $mesgDNABank .= "sample is"; }
if($gesamt > 1) { $mesgDNABank .= "samples are"; }
$mesgDNABank .= " available and send an email offer containing binding prices and shipping fees to the customer.
";
$mesgDNABank .= $message; //Taxa und DNA-Nummern
$mesgDNABank .= "
Your order will be directed to the DNA bank(s) in authority of requested samples. Every DNA bank only receives its relevant order information. Subsequently a confirmation email will be send to you by the DNA bank(s) in question. An offer including binding prices will than be made within a separate email.
'; }
if($formSubmitOrder2)
{
$mesg = "
Dear ".$Forename." ".$Surname.". ";
$mesg .= "Thank you very much for your request of DNA samples from the DNA Bank Network. You preconfirmed ".$items;
if($gesamt == 1) { $mesg .= " sample "; }
if($gesamt > 1) { $mesg .= " samples "; }
$mesg .= "from ".$sum;
if($sum == 1) { $mesg .= " DNA bank"; }
if($sum > 1) { $mesg .= " DNA banks"; }
$mesg .= ".
Your inquiry has been forwarded to the DNA bank(s) in authority of the requested samples. Shortly you will receive an email offer of these DNA bank(s) including binding sample prices and shipping fees.
Thank you for your interest.
Sincerely, The DNA Bank Network Team
";
$mesg .= "
";
$from = "From: contact@dnabank-network.org\n";
$from .= "Content-Type: text/html\n";
mail($Email, "DNA Bank Network - Order Confirmation", htmlspecialchars_decode($mesg), $from);
$sqldelete = "DELETE FROM tablecart WHERE ID_User = '$UserID' and Session = '$SID'";
$resultdelete = mysql_query($sqldelete);
}
echo "
";
echo "
";
}
}
else {
if($SID)
{
/*******************************************************************************************************
* Zusammenbauen der Ergebnisse allgemein *
* *
*******************************************************************************************************/
// Abfrage für TableDnaBankNumbers
$result1 = mysql_query
("SELECT tablecache.ID_Cache AS ID_Cache, " .
" tablecache.ID_Dataset_Specimen AS ID_Dataset_Specimen, " .
" tablecache.UnitID_Specimen AS UnitID_Specimen, " .
" tablecache.CollectionCode_Specimen AS CollectionCode_Specimen, " .
" tablecache.InstitutionCode_Specimen AS InstitutionCode_Specimen, " .
// " tablecache.Continent AS Continent, " .
" tablecache.CountryName AS CountryName, " .
// " tablecache.CountryISO2 AS CountryISO2, " .
// " tablecache.Collector AS Collector, " .
// " tablecache.CollectionDate AS CollectionDate, " .
// " tablecache.CollectorsNo AS CollectorsNo, " .
// " tablecache.LocalityText AS LocalityText, " .
// " tablecache.Altitude AS Altitude, " .
// " tablecache.LongitudeDecimal AS LongitudeDecimal, " .
// " tablecache.LatitudeDecimal AS LatitudeDecimal, " .
" tablecache.UnitID_DNA AS UnitID_DNA, " .
" tablecache.CollectionCode_DNA AS CollectionCode_DNA, " .
" tablecache.InstitutionCode_DNA AS InstitutionCode_DNA, " .
" tablecache.Blocked_Until AS Blocked_Until " .
" FROM tablecache JOIN tmpDnaIDs " .
" WHERE tablecache.ID_Cache = tmpDnaIDs.ID_Cache");
if(!$result1) { echo "
";
if((!isset($_COOKIE['test']) or !$_COOKIE['test']) and $_GET['UnitIDS'] = "") {
echo "Please enable Cookies! Otherwise search will not work properly. ";}
echo "
Sorry, this DNA sample is blocked and can not be ordered until '.$row->Blocked_Until.'.
Please contact the '.$row->InstitutionCode_DNA.' for further details!
On-demand DNA extraction is possible for this specimen. Please use the order function to it. Your on-demand extraction request will then be forwarded to the ".$InstitutionCode_DNA. ".