示例#1
0
    if (preg_match("/multiple matching addresses/i", $buffer) || preg_match("/multiple matches found/i", $buffer)) {
        $result = "Ambiguous";
    } else {
        if (preg_match("/could not find address/i", $buffer) || preg_match("/unable to find address/i", $buffer) || preg_match("/could not parse address/i", $buffer)) {
            $result = "Not Found";
        } else {
            if (preg_match("/id=\"error_pane\"/", $buffer) || preg_match("/quot;errors\\": \\"\\",/", $buffer)) {
            } else {
                if (preg_match("/error/i", $buffer)) {
                    $result = "Error";
                }
            }
        }
    }
}
fclose($fp);
# If we found an address, try to clean it up
if ($addr != "") {
    # If intersection and both quadrants are the same, then only keep the first
    $quadrant = preg_replace('/^([NESW][EW]?) .*/', '$1', $addr);
    if ($quadrant != $addr) {
        $addr = preg_replace("/ & {$quadrant} /", " and ", $addr);
    }
    # append the city unless it is "Portland" and the given address string
    # didn't contain "Portland".
    if ($city != "" && ($city != "Portland" || preg_match("/portland/i", $_REQUEST["address"]))) {
        $addr = "{$addr}, {$city}";
    }
}
sendresult($result, $addr);
# vi:se sw=4:
示例#2
0
<?php

header('Content-type:text-plain');
$query = $_GET['query'];
$database = $_GET['database'];
$version = $_GET['version'];
$result = search($query, $database, $version);
sendresult($result);
function search($query, $database, $version)
{
    if (strlen($query) == 0) {
        return;
    }
    //if (!preg_match('/[0-9]/', $query))
    //	return;
    $doop_version = strtr($version, ".", "_");
    $doop_database = 'doop-' . "{$database}" . '-' . "{$doop_version}";
    if (!($db = @mysql_pconnect('localhost', 'promoter', 'sql04CP'))) {
        die;
    }
    if (!mysql_select_db($doop_database, $db)) {
        die;
    }
    $mysql_result = "";
    $mysql_result = mysql_query("SELECT sequence_gene_name FROM sequence_annotation WHERE sequence_gene_name LIKE '{$query}%' GROUP BY sequence_gene_name ORDER BY sequence_gene_name LIMIT 10;");
    $resno = mysql_num_rows($mysql_result);
    if ($resno == 0) {
        return;
    } else {
        while ($row = mysql_fetch_row($mysql_result)) {
            $gene_id = $row[0];
示例#3
0
    return $best;
}
function sendresult($result, $addr)
{
    print "<vfyvenue>\n";
    print "  <result>" . $result . "</result>\n";
    if ($addr) {
        if ($result == "Verified") {
            print "  <locname>" . htmlspecialchars($addr["locname"]) . "</locname>\n";
        }
        print "  <address>" . htmlspecialchars($addr["address"]) . "</address>\n";
        print "  <area>{$addr[area]}</area>\n";
    }
    print "</vfyvenue>\n";
    exit;
}
###############################################################################
# First try looking it up in the database of inspected/approved venues
$addr = bestaddress($_REQUEST["locname"], 1);
if ($addr) {
    sendresult("Verified", $addr);
    exit;
}
# Second try looking it up in the database of user-supplied venues
$addr = bestaddress($_REQUEST["locname"], 0);
if ($addr) {
    sendresult("Known", $addr);
    exit;
}
sendresult("Unknown", null);