function requetetoecho($req, $page, $nb_element, $bdd) { $allowed = array(3, 7); $aff = ''; $req = $bdd->query($req . ' LIMIT ' . intval($page - 1) * $nb_element . ',' . $nb_element); $i = 0; while ($resultat = $req->fetch()) { $i++; $aff .= '<a href="?p=video&c=' . $resultat['link'] . '" target="_blank" title="' . $resultat['title'] . '">'; $aff .= ' <div class="vig">'; $aff .= ' <div class="colgau" style="background:url(http://img.youtube.com/vi/' . $resultat['link'] . '/1.jpg) no-repeat;">'; $aff .= ' </div>'; $aff .= ' <div class="coldro">'; $aff .= ' <div class="titre">'; $aff .= ' <span class="dark_brown">' . substr($resultat['title'], 0, 40) . (strlen($resultat['title']) > 40 ? '...' : '') . '</span>'; $aff .= ' </div>'; $aff .= ' <div class="description">'; $aff .= ' <span class="less_dark size14">' . (!empty($resultat['description']) ? substr($resultat['description'], 0, 40) . (strlen($resultat['description']) > 40 ? '...' : '') : 'No description yet ...') . '</span>'; $aff .= ' </div>'; $aff .= ' <div class="info_search">'; $aff .= ' <span class="size12">views :</span> <span class="blue size12">' . afficher_nb_vues("../", $resultat['id_cover'], $resultat['id_utilisateur']) . '</span> <span class="size12"> by : </span><span class="blue size12">' . $resultat['login'] . '</span>'; $aff .= ' </div>'; $aff .= ' </div>'; $aff .= ' </div>'; $aff .= '</a>'; if (isset($_SESSION['utilisateur']['id_utilisateur']) && in_array($_SESSION['utilisateur']['id_utilisateur'], $allowed)) { $aff .= ' <a href="c/c.black_listing.php?id_video=' . $resultat['link'] . '&id_utilisateur=' . $resultat['id_utilisateur'] . '">'; $aff .= ' <div class="del_s"></div>'; $aff .= ' </a>'; } } if ($i == 0) { $aff .= ' <div class="center less_dark">No video found for your search...</div>'; } return $aff; }
AND a.id_utilisateur = b.id_utilisateur AND link <> "' . $_GET['c'] . '" ORDER BY id_cover DESC LIMIT 5'; $aff = ''; $req = $bdd->query($req); while ($resultat = $req->fetch()) { $aff .= ' <div class="vig">'; $aff .= ' <div class="image"><img width="115" height="77" src="http://img.youtube.com/vi/' . $resultat['link'] . '/1.jpg" /></div>'; $aff .= ' <div class="texte">'; $aff .= ' <a class="lien_englobe" href="?p=video&c=' . $resultat['link'] . '" title="' . $resultat['title'] . '">'; $aff .= ' <div class="titre size14">' . substr($resultat['title'], 0, 18) . (strlen($resultat['title']) > 18 ? '. . . ' : '') . '</div>'; $aff .= ' </a>'; $aff .= ' <span class="size12">by : </span><span class="blue size12">' . $resultat['login'] . '</span>'; $aff .= ' <div class="count size12">'; $aff .= ' <span class="blue">' . afficher_nb_vues("", $resultat['id_cover'], $id_utilisateur) . '</span> <span>views</span>'; $aff .= ' </div>'; $aff .= ' </div>'; $aff .= '</div>'; } $req->closeCursor(); echo $aff; unset($resultat); unset($aff); ?> <div class="clear"></div> </div> </div> <div class="clear"></div> </div> <script>