Example #1
0
    //create PDO connection
    $db = new PDO('mysql:host=localhost;dbname=Software', $user, $pass);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    //show error
    echo '<p class="bg-danger">' . $e->getMessage() . '</p>';
    exit;
}
if ($_GET['func'] == 'getImage') {
    getImage($_GET['ID'], $db);
} elseif ($_GET['func'] == 'getName') {
    getName($_GET['ID'], $db);
} elseif ($_GET['func'] == 'getPrice') {
    getPrice($_GET['ID'], $db);
} elseif ($_GET['func'] == 'getDesc') {
    getDesc($_GET['ID'], $db);
}
function getImage($id, $db)
{
    $sql = "SELECT * FROM Product WHERE ID={$id}";
    $query = $db->prepare($sql);
    $query->execute();
    $results = $query->fetchAll(PDO::FETCH_ASSOC);
    foreach ($results as $row) {
    }
    echo $row['Picture'];
}
function getName($id, $db)
{
    $sql = "SELECT * FROM Product WHERE ID={$id}";
    $query = $db->prepare($sql);
Example #2
0
if (isset($_POST['go_back'])) {
    header("Location: ./product.php");
}
//include the files that our program needs
require '../common/class_pdo.php';
require '../common/producto.php';
require '../common/functions_pc.php';
//Include the smarty lib
require '../../libs/smarty/libs/Smarty.class.php';
//init an object of the smarty class
$smarty = new Smarty();
//init basic attributes
$smarty->template_dir = '../templates/';
$smarty->compile_dir = '../templates_c/';
$smarty->config_dir = '../configs/';
$smarty->cache_dir = '../cache/';
/*
 * 
 * 
 * INICIO DEL PROGRAMA
 * 
 * 
 */
$user = $_SESSION['username'];
$smarty->assign('user', $user);
$cod_pc = filter_input(INPUT_GET, 'pc');
$computer = getPC($cod_pc);
$computer_desc = getDesc($cod_pc);
$smarty->assign("pc", $computer);
$smarty->assign("desc", $computer_desc);
$smarty->display("computers.tpl");
Example #3
0
            $data['param'][] = array('type' => $matches[1], 'name' => $matches[2], 'desc' => $matches[3]);
            $data['hasparam'] = true;
        } elseif (preg_match('/@return/', $value)) {
            preg_match('/return\\s*([^\\s]*)\\s*(.*)\\r/', $value, $matches);
            $data['return'] = array('type' => $matches[1], 'desc' => $matches[2]);
        } elseif (preg_match('/@example/', $value)) {
            $data['example'] = array();
            $example = explode('示例代码:', preg_replace('/@example\\s/', '', $value));
            $data['example']['desc'] = preg_replace('/\\r\\n/', '<br />', $example[0]);
            $example[1] && ($data['example']['code'] = $example[1]);
        }
    }
    $datas[] = $data;
}
// 匹配注释块
preg_match_all('/\\/\\*[\\s\\S]*?\\*\\//', $content, $matches);
$matches = $matches[0];
// 过滤出标准API注释块
foreach ($matches as $key => $matche) {
    if (!preg_match('/@description/', $matche)) {
        unset($matches[$key]);
    }
}
// 匹配出注释块的每一项
$datas = array();
foreach ($matches as $key => $matche) {
    preg_match_all('/(@[\\s\\S]*?)(?:\\*\\s|\\*\\/)/', $matche, $items);
    // var_dump($items[1]);
    getDesc($items[1]);
}
echo json_encode($datas);
Example #4
0
        }
    }
}
?>

function listaliases(){
if [ $(tput cols) -le 40 ]; then
	echo "Your terminal is too small."
else
	<?php 
if (isset($aliascategories)) {
    foreach ($aliascategories as $cat => $files) {
        echo "echo '  " . $cat . " Aliases'\n";
        foreach ($files as $path => $file) {
            echo "echo -e \"    " . str_pad($file, 25, " ") . "-- ";
            echo "\$(fold -s -w \$[\$(tput cols) - 32] <<< \"" . getDesc($path) . "\"| sed -e 's/^/\\\\033[33G/g')\"\n";
        }
        echo "echo \n";
    }
} else {
    echo "echo 'No Available Aliases'\n";
}
?>
fi
}

<?php 
if (isset($aliascategories)) {
    foreach ($aliascategories as $files) {
        foreach ($files as $path => $file) {
            require_once $path;