Ejemplo n.º 1
0
    include './db_clear.php';
    //читаем файл
    $txt = file($_FILES['file']['tmp_name']);
    //убираем первые 17 строк и последние 5
    array_splice($txt, 0, 17);
    array_splice($txt, -5, 5);
    $txt = implode("", $txt);
    $f = fopen('test.txt', 'w');
    fwrite($f, $txt);
    fclose($f);
    $txt = explode('*', $txt);
    for ($i = 0; $i < count($txt); $i += 2) {
        $document[trim($txt[$i])] = $txt[$i + 1];
    }
    //разбираем узлы
    if (isset($document['JOINT COORDINATES'])) {
        $nodes = new TNode();
        $nodes->get_from_staad_std($document['JOINT COORDINATES']);
        echo '- Узлы;<br/>';
    }
    //разбираем элементы
    if (isset($document['MEMBER INCIDENCE'])) {
        $members = new TMember();
        $members->get_from_staad_std($document['MEMBER INCIDENCE']);
        echo '- Элементы;<br/>';
    }
} else {
    echo "Не могу прочитать файл *.std!";
}
//закрываем соединение с базой
mysql_close($dbh);