public function recherche($nom, $prenom = "") { $filter = 'AND'; if (empty($prenom)) { $prenom = $nom; $filter = 'OR'; } $nom = strtoupper($this->mysql->real_escape_string($nom)); $prenom = strtoupper($this->mysql->real_escape_string($prenom)); $sql = 'SELECT aid,anom,aprenom,biographie,adnaissance,aphoto,avalide FROM auteurs WHERE UPPER(anom) LIKE "%' . $nom . '%" ' . $filter . ' UPPER(aprenom) LIKE "%' . $prenom . '%"'; return queryToArray($this->mysql->query($sql)); }
public function liste() { $sql = 'SELECT eid,enom,evalide FROM editeurs'; return queryToArray($this->mysql->query($sql)); }
<?php /** * Created by PhpStorm. * User: Cristian * Date: 8/4/2015 * Time: 5:14 PM */ $lang = getSiteLanguage(); $currencies = new currencies(); $query = "select p.products_id, p.products_image, p.products_price, s.specials_new_products_price, p.products_tax_class_id, p.products_quantity, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_opt5 = 'A' and pd.language_id = '" . $lang['id'] . "' order by p.products_date_added desc"; $data = queryToArray($query); $columns = 12 / count($data); ?> <div class="col-xs-12"> <div class="panel panel-info"> <div class="panel-heading"><?php echo Translate('Nieuw in ons Assortiment'); ?> </div> <div class="panel-body"> <?php for ($i = 0; $i < count($data); $i++) { ?> <div class="col-xs-<?php echo $columns; ?> text-center"> <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $data[$i]["products_id"]); ?>
public function listeAmis() { $uid = $this->getUid(); $sql = 'SELECT u.uid,u.pseudo,u.email,u.dinscription,u.ipinscription,u.uetat,a.date_ajout,u.avatar FROM utilisateurs u JOIN amis a ON (a.euid=u.uid AND a.duid=' . $uid . ') OR (a.euid=' . $uid . ' AND a.duid=u.uid) ORDER BY u.pseudo'; return queryToArray($this->mysql->query($sql)); }
/** * 获取个应用系统登录接口地址 * * @param bool $is_register true 表示注册 * @return array|null * @throws \yii\base\Exception */ public function getCookieUrl($is_register = false) { $cookieUrl = null; $appId = null; $info = null; $userModel = new UserBaseInfo(); $userInfo = $userModel->getUserInfoCache(); $sso = SsoSettingInfo::findAll(); if ($sso) { foreach ($sso as $k => $val) { if (isset($val['log_out']['sign_in']) && $val['log_out']['sign_in']) { $cookieUrl[] = $val['log_out']['sign_in']; $appId[] = $val['app_id']; } } } if (isset($userInfo['id']) && $userInfo['id'] && $cookieUrl) { $user = $userModel->getUserById($userInfo['id']); $info['openid'] = $user['open_id']; $info['mobile'] = $user['mobile']; $info['email'] = $user['email']; if ($is_register) { $info['is_register'] = $is_register; $info['salt'] = $user['password_salt']; $info['password'] = $user['password']; } $info = json_encode($info); foreach ($cookieUrl as $key => &$url) { $appDir = $appId[$key]; $encrypt = AsymmetryCrypt::opensslPublicEncrypt($info, dirname(Yii::$app->getBasePath()) . '/common/rsa_key/' . $appDir . '/rsa_public_key.pem'); // TODO:: 为解决 +/ 丢失 / bug,临时解决方案 $encrypt = str_replace('+/', '+_', $encrypt); $encrypt = rawurlencode($encrypt); $bool = filter_var($url, FILTER_VALIDATE_URL); if ($bool === false) { unset($cookieUrl[$key]); continue; } $path = parse_url($url); if (!isset($path['query'])) { $url .= '?c=' . $encrypt; continue; } $query = queryToArray($path['query']); $query['c'] = $encrypt; $query_params = arrayToQuery($query); $url = $path['scheme'] . '://' . $path['host'] . '?' . $query_params; } shuffle($cookieUrl); return $cookieUrl; } else { return null; } }
public function recherche($motcle) { // Fonction qui permet de faire une recherche à partir de n'importe quel champ de type texte dans la base de données $uid = requestObject('Utilisateurs')->getUid(); // Protection du motclé : $motcle = $this->mysql->real_escape_string($motcle); $sql = 'SELECT l.lid,l.nom,l.isbn,l.ean13,l.date_publication,l.lvalide,l.description,a.aid,a.aprenom,a.anom,s.snom,g.gnom,e.enom,ajdate,ap.date_achat,ap.etat,ap.emplacement FROM livres l JOIN auteurs a ON l.aid=a.aid LEFT JOIN series s ON l.serie=s.sid LEFT JOIN genre g ON l.genre=g.gid LEFT JOIN editeurs e ON e.eid=l.editeur LEFT JOIN utilisateurs u ON l.ajuid=u.uid LEFT JOIN appartient ap ON ap.lid=l.lid AND ap.uid=' . $uid . ' WHERE l.nom LIKE "%' . $motcle . '%"'; return queryToArray($this->mysql->query($sql)); }
public function liste() { $sql = 'SELECT gid,gnom,svalide FROM genre'; return queryToArray($this->mysql->query($sql)); }
} $SQL_LIMIT_VOTED = 40; $SQL_LIMIT_ALL = 10; $SQL_SEXO = isset($_GET["sexo"]) && preg_match('/^[HM]$/', $_GET["sexo"]) ? "'" . $_GET["sexo"] . "'" : "'H'"; $SQL_USER = isset($_GET["user"]) ? "'" . $_GET["user"] . "'" : "'Dan'"; $SQL_FREQ_MAX = isset($_GET["freqMax"]) && is_numeric($_GET["freqMax"]) ? " AND frecuencia <=" . (double) $_GET["freqMax"] : ""; $SQL_FREQ_MIN = isset($_GET["freqMin"]) && is_numeric($_GET["freqMin"]) ? " AND frecuencia >=" . (double) $_GET["freqMin"] : ""; $SQL_COMP_NAM = !isset($_GET["multiName"]) ? " AND nombre not like '% %'" : ""; $SQL_COUNT = isset($_GET["count"]) ? true : false; $query1 = "SELECT n.id, n.nombre " . " from votos v " . " left join nombres n on v.idName like n.id " . " where v.user like {$SQL_USER} " . " and n.sexo like {$SQL_SEXO} " . $SQL_FREQ_MIN . $SQL_FREQ_MAX . $SQL_COMP_NAM . " order by rand() " . " limit {$SQL_LIMIT_VOTED}"; $query2 = "SELECT id, nombre " . " from nombres " . " where sexo like {$SQL_SEXO} " . $SQL_FREQ_MIN . $SQL_FREQ_MAX . $SQL_COMP_NAM . " order by rand() " . " limit {$SQL_LIMIT_ALL}"; //Si se realiza una consulta de número de nombres disponible, se redirige la consulta a getCount.php if ($SQL_COUNT) { header("Location: ./getCount.php?" . $_SERVER['QUERY_STRING']); exit; } $items = array(); $mysqli = new mysqli("localhost", "names", "como1cerda=)", "names") or die('Could not connect to the database server' . $mysqli->connect_error); //obtenemos una sublista de nombres votados queryToArray($mysqli, $query1, $items); //obtenemos una sublista de nombres (votados y no votados) queryToArray($mysqli, $query2, $items); $mysqli->close(); //randomizamos el order shuffle_with_keys($items); //formateamos la salida $string = ''; foreach ($items as $k => $v) { $string .= $k . ":" . $v . ";"; } echo htmlspecialchars(substr($string, 0, -1));
public function liste() { $sql = 'SELECT sid,snom,svalide FROM series'; return queryToArray($this->mysql->query($sql)); }