Example #1
0
// IF VENDORS FOR ENDONUCLEASES ARE REQUETED (pe. ?endo=EcoRI), RESPOND AND DIE
//   Two functions (in the bottom) are used to respond
if ($_GET["endo"]) {
    // Get array of companies selling each endonuclease
    $vendors = endonuclease_vendors();
    // get array of endonucleases requested
    $endonuclease = preg_split("/,/", $_GET["endo"]);
    // start printing results
    print "<html><head><title>Vendors for " . $_GET["endo"] . "</title></head>\n<body bgcolor=FFFFFF>\n";
    print "<div align=right><a href=" . $_SERVER["PHP_SELF"] . ">Home</a></div>\n";
    if (strpos($_GET["endo"], ",") > 0) {
        print "All endonucleases bellow are isoschizomers<hr>\n";
    }
    // print vendor for each endonuclease (uses a function)
    foreach ($endonuclease as $enzyme) {
        show_vendors($vendors[$enzyme], $enzyme);
    }
    print "</body>\n</html>";
    die;
    // die
}
// IF NO DATA IS POSTED, PRINT THE FORM AND DIE
// the form is within a function
if (!$_POST) {
    print_form();
    die;
}
// WHEN DATA IS POSTED, YOU WILL GET HERE
// Obtain sequence
$text = $_POST["sequence"];
// apply limit
    $y = array(0, 0, 0, 0, 0, 0, 0, 0);
    foreach ($vendors as $name => $x) {
        if (!$name) {
            $name = "not reported by client";
        } else {
            $name = "<a href=android_tasks.php?vendor={$name}>{$name}</a>";
        }
        show_item($name, $x);
        $y[1] += $x[1];
        $y[3] += $x[3];
    }
    show_item("total", $y);
    end_table();
    page_tail();
}
$models = get_cached_data(86400);
if ($models) {
    $models = unserialize($models);
} else {
    $models = get_models();
    set_cached_data(86400, serialize($models));
}
$vendor = get_str("vendor", true);
if ($vendor) {
    uasort($models, 'compare');
    show_vendor($vendor, $models);
} else {
    $vendors = get_vendors($models);
    uasort($vendors, 'compare');
    show_vendors($vendors);
}