<?php
set_time_limit(1200);

//From http request or command line
if (!isset($_SERVER["HTTP_HOST"])) {
    parse_str($argv[1], $_POST);
    foreach($_POST as $key => $val){
        $_POST[$key] = rtrim($val);
    }
    chdir($_POST['path']);
    set_time_limit(0);
}

require '../conf/config.php';
require './common.php';
////////////////////////////////// Connecting with DB
if( !$conn = new mysqli($host, $user, $pswd, $db)) {
    error_log("Connection failed.\n");
    exit;
}
(isset($_POST['accession']) && !empty($_POST['accession'])) ? $accession=$_POST['accession']:returnError("Error");
_pregMatch($accession);
$stmt = $conn->stmt_init();
$query = "SELECT accession_db FROM sys_accession";
$stmt->prepare($query);
//$stmt->bind_param('is',$accession);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($row0);
while ($stmt->fetch()) {
		$accdb = $row0;
}
echo $accdb;
?>
