function q($query) { $r = qq($query); if (is_array($r)) { $r = reset($r); } else { $r = false; } re($r); return $r; }
function printqn($text) { print qq($text) . "\n"; }
function qminimal($a) { if (is_intval($a)) { return (string) $a; } return qq($a); }
//音乐标题 $title = urldecode($_REQUEST[title]); //艺术家名称 $artist = urldecode($_REQUEST[artist]); //由-横杠分解出艺术家和标题 if (empty($artist)) { $arr = split("-", $title); $size = sizeof($arr); if ($size > 1) { $artist = trim($arr[0]); $title = trim($arr[1]); } } $lrc = tt($artist, $title); if (!$lrc) { $lrc = qq($artist, $title); } if (!$lrc) { $lrc = "[ti:歌词未找到]"; } echo $lrc; function tt($artist, $title) { $s_doc = new DOMDocument(); $s_doc->load("http://ttlrcct.qianqian.com/dll/lyricsvr.dll?svrlst"); $s_list = $s_doc->getElementsByTagName("server"); if ($s_list->length == 0) { return; } $s = $s_list->item(0); $s_url = $s->getAttribute("url");
begin_debug(); // By default, localhost root/root MySQL user is used. Set $q_server, $q_user, $q_password to override $q_database = 'imdb_sample'; q("CREATE TABLE IF NOT EXISTS films (title VARCHAR(250), year SMALLINT, cover VARCHAR(250))"); $http_cache = true; http_get('http://www.imdb.com/chart/top/'); foreach (tags_html('.titleColumn') as $film) { set_source($film); $year = inside('(', ')', tag_text('.secondaryInfo')); if ($year < 2015) { continue; } http_get(tag_link('a')); // Open film link $title = q_escape(replace('(*)', '', tag_text('h1'))); // Take title and remove year like (2015) from it if (q("SELECT * FROM films WHERE title={$title}")) { continue; } // If film already in DB, skip http_get(tag_link('.poster')); // Open poster link $cover = q_escape(http_get_file(tag_image('#primary-img'), 'covers/')); // Download primary image from slideshow q("INSERT INTO films SET title={$title}, year={$year}, cover={$cover}"); } // Lets output the films from our DB foreach (qq("SELECT * FROM films") as $film) { echo "<h1><img src='{$film['cover']}' /> {$film['title']} <i>({$film['year']})</i></h1>"; } // THE END
function getClientesTPV($time = false) { $out = ""; $jsLex = new jsLextable(); $clientes = array(); $clientesruc = array(); $clientebono = array(); $clientedebe = array(); $clientepromo = array(); $extraChange = $time ? " AND UNIX_TIMESTAMP(FechaChange) > UNIX_TIMESTAMP() - " . $time : ""; $sql = " select IdCliente,TipoCliente,Telefono1,Direccion,Email, " . " NombreLegal as legal,NombreComercial as comercial,Bono," . " NumeroFiscal as NFiscal,Comentarios,FechaNacimiento," . " ( select sum(ges_comprobantes.ImportePendiente) " . " from ges_comprobantes " . " where ges_comprobantes.ImportePendiente > 0 " . " and ges_comprobantes.Status IN(1,3) " . " and ges_comprobantes.Destinatario = 'Cliente' " . " and ges_comprobantes.IdCliente = ges_clientes.IdCliente " . " group by ges_comprobantes.IdCliente ) as Debe " . " from ges_clientes " . " where TipoCliente <> 'Interno' " . " {$extraChange} " . " and Eliminado = 0 " . " order by NombreComercial asc"; $res = query($sql); while ($row = Row($res)) { $promo = cargarPromocionCliente($row["IdCliente"]); $bono = $row["Bono"] ? $row["Bono"] : 0; $promo = $promo ? $promo : 0; $debe = $row["Debe"] * 1.0; $comercial = str_replace('&', '&', $row["comercial"]); $legal = str_replace('&', '&', $row["legal"]); $out .= "aU( " . qq($comercial) . "," . $row["IdCliente"] . "," . $debe . "," . "'" . $row["NFiscal"] . "'" . "," . $bono . ",'" . $promo . "','" . $row["TipoCliente"] . "'," . qq($row["Telefono1"]) . "," . qq($row["Email"]) . "," . qq($row["Direccion"]) . "," . qq($legal) . "," . qq($row["FechaNacimiento"]) . "," . qq($row["Comentarios"]) . " );\n"; } return $out; }