Esempio n. 1
0
                            ?>
&gal=<?php 
                            echo $RowNOTICIAS['id'];
                            ?>
&noticia=<?php 
                            echo $RowSEL['id'];
                            ?>
'"><?php 
                            echo $RowSEL['nombre'];
                            ?>
</label><label class="titulo_gris_pequenyo"> (<?php 
                            echo utf8_decode($db[0]->title);
                            ?>
)</label><?php 
                        } else {
                            $db = readDatabase($RowSEL['xml']);
                            //print_r($db);
                            ?>
<br><label class="titulo_blanco_pequenyo" style="cursor:pointer" onclick="parent.frames['<?php 
                            echo $RowMENUNOT['target'];
                            ?>
'].location.href='<?php 
                            echo $RowMENUNOT['redireccion'];
                            ?>
?id_session=<?php 
                            echo $id_session;
                            ?>
&menu=<?php 
                            echo $RowMENUNOT['id_menu'];
                            ?>
&gal=<?php 
Esempio n. 2
0
<?php

/**
 * 对主页传进来的URL进行解析
 *
 * Date: 2015/12/9
 * Time: 16:55
 */
require_once '../config/Constant.php';
require_once '../database/ProductsDB.php';
require_once '../smarty/config.php';
require_once '../phpqrcode/phpqrcode.php';
//得到URL 传进来的id
$id = $_GET['id'];
if (!$smarty->isCached('item_product.tpl', $id)) {
    $itemProduct = readDatabase($id);
    $screenShotObject = parseJSON($itemProduct);
    generateQRCode($itemProduct);
    $smarty->assign('qrCodeImage', QR_NAME);
    $smarty->assign('itemProduct', $itemProduct);
    $smarty->assign('screenShotArray', $screenShotObject);
}
$smarty->display('item_product.tpl', $id);
/**
 * 生成QRCode
 */
function generateQRCode($itemProduct)
{
    //在这里要确保 products文件夹中apk名字 与 数据库名字一样
    $qrCodeHref = DOMAIN . '/products' . '/' . $itemProduct['download'];
    define('QR_NAME', 'itemQRCode.png');
Esempio n. 3
0
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, $data, $values, $tags);
    xml_parser_free($parser);
    // loop through the structures
    foreach ($tags as $key => $val) {
        if ($key == "molecule") {
            $molranges = $val;
            // each contiguous pair of array entries are the
            // lower and upper range for each molecule definition
            for ($i = 0; $i < count($molranges); $i += 2) {
                $offset = $molranges[$i] + 1;
                $len = $molranges[$i + 1] - $offset;
                $tdb[] = parseMol(array_slice($values, $offset, $len));
            }
        } else {
            continue;
        }
    }
    return $tdb;
}
function parseMol($mvalues)
{
    for ($i = 0; $i < count($mvalues); $i++) {
        $mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"];
    }
    return new AminoAcid($mol);
}
$file = getenv('PCC_HOME') . '/runtime/ext/xml/tests/moldb.xml';
$db = readDatabase($file);
echo "** Database of AminoAcid objects:\n";
var_dump($db);
Esempio n. 4
0
<?php

require "dbcon.php";
$conn = readDatabase();
$stmt = $conn->prepare("SELECT hive_id, num_mites, collection_date FROM samples");
$stmt->execute();
echo "<table>";
echo "<tr>";
echo "<th>Hive ID</th>";
echo "<th>Mites</th>";
echo "<th>Sample Date</th>";
echo "</tr>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr>";
    echo "<td>" . $row['hive_id'] . "</td>";
    echo "<td>" . $row['num_mites'] . "</td>";
    echo "<td>" . $row['collection_date'] . "</td>";
    echo "</tr>";
}
echo "</table>";
Esempio n. 5
0
<?php

define('ROOT_DIR', __DIR__);
require_once 'config/Constant.php';
require_once 'database/PostTable.php';
require_once 'database/FriendsDB.php';
require_once 'database/ProductsDB.php';
require_once 'database/TravelDB.php';
require_once 'smarty/config.php';
//如果已有缓存 就不需要操作数据库
if (!$smarty->isCached('index.tpl')) {
    readDatabase($smarty);
}
$smarty->display("index.tpl");
function readDatabase(Smarty $smarty)
{
    //Blog
    $smarty->assign("blogArray", PostTable::fetchPostTable('-comment_count'));
    //Products
    $productsArray = ProductsDB::newInstance();
    $smarty->assign("productsArray", $productsArray->fetchData(3));
    //Travel
    $travelArray = TravelDB::newInstance();
    $smarty->assign("travelArray", $travelArray->fetchData(6));
}
Esempio n. 6
0
{
    echo '<h4>Читаем данные из таблицы в массив</h4>';
    $projects = readProjects();
    //    echo('<h3>Выводим весь массив</h3>');
    //    print_r($projects);
    echo '<h4>Выводим массив построчно</h4>';
    foreach ($projects as $row) {
        echo '<p>' . $row['id'] . ' ' . $row['name'] . ' ' . $row['url'] . ' ' . $row['description'] . ' ' . $row['image'] . '</p>';
    }
}
echo '<h3>Первоначальное чтение из базы</h3>';
readDatabase();
echo '<h3>Следующий шаг - запись в базу</h3>';
writeProject('projectname', 'projectUrl', 'projectDecr', 'projectImage');
echo '<h3>Снова чтение из базы уже обновлённых данных</h3>';
readDatabase();
echo '<h3>Выведем сведения о сервере</h3>';
phpinfo();
/* Катин код fileUpload
function _initFileUpload () {

    $('#project-file').fileupload({
            url: 'UploadHandler.php',
            dataType: 'json',
            replaceFileInput: false,
            maxNumberOfFiles: 1,
            add: function(e, data) {
        if (!~data.files[0].type.indexOf('image')) {
            $showTooltip($(this), 'Файл не картинка', 'left');
        } else
            if (data.files[0].size > 5000000) {