Immagine di libri volanti
Professionisti al Vostro servizio
Ricerca avanzata
Google Ricerca per parola chiave nel sito www.campedel.it
Ricerca per parola chiave:
Autore:
Titolo o parola:
Collana:
Titolo esatto:
Editore:
Anno di edizione:
ISBN13:
Codice:
Pagine con elenchi e proposte
Consigli
consigli
Novità
novità
Offerte
offerte

© Libreria Campedèl - Piazza dei Martiri,27/d - 32100 Belluno - telefono +39.0437.943153 fax +39.0437.956904

"; $gen=''; $tit=''; $aut=''; $edi=''; $par=''; $col=''; $anno=''; $isb=''; $cod=''; $gen = addslashes($_POST['gen']); // This is our search term, has a little sql injection protection with addslashes. $tit = addslashes($_POST['tit']); // This is our search term, has a little sql injection protection with addslashes. $aut = addslashes($_POST['aut']); // This is our search term, has a little sql injection protection with addslashes. $par = addslashes($_POST['par']); // This is our search term, has a little sql injection protection with addslashes. $col = addslashes($_POST['col']); // This is our search term, has a little sql injection protection with addslashes. $isb = addslashes($_POST['isb']); // This is our search term, has a little sql injection protection with addslashes. $edi = addslashes($_POST['edi']); // This is our search term, has a little sql injection protection with addslashes. $anno= addslashes($_POST['anno']); // This is our search term, has a little sql injection protection with addslashes. $cod = addslashes($_POST['cod']); // This is our search term, has a little sql injection protection with addslashes. $ric=''; $x=0 ; $a[0]=""; // scomposizione del titolo togliendo gli articoli if ($tit<>''){ $x++; $tit = strtoupper($tit) . " "; $tit=str_replace("\\\'"," ",$tit); $tit=str_replace("\\"," ",$tit); $length = strpos($tit," "); $a[$x] = strtoupper(substr($tit,0,$length)); if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' OR $a[$x]=='L') { $tit = substr($tit,($length+1)); $a[$x]==''; } if ($tit<>''){ $tit= trim($tit); $tit=str_replace("À","%",$tit); $tit=str_replace("È","%",$tit); $tit=str_replace("É","%",$tit); $tit=str_replace("Ù","%",$tit); $tit=str_replace("Ò","%",$tit); $tit=str_replace("Ì","%",$tit); $a[$x]= $tit; $ric = "(`Titolo` LIKE '%$tit%' )"; } } // scomposizione del titolo in parole chiave togliendo gli articoli $gen = $gen . " "; $RicGe ='' ; while( trim($gen)<>'') { $x++; $a[$x] = ""; $length = strpos( $gen, "'" ); // delimita una parola ed elimina il pimo apostrovo e la lettera che precede l'apostrofo if ($length>0) { $a[$x] = strtoupper(substr($gen,0,$length-4)); $gen = substr($gen,($length+1)); }else{ $length = strpos($gen," "); // delimita una parola $a[$x] = strtoupper(substr($gen,0,$length)); $gen= substr($gen,($length+1)); } if ($a[$x] <> ''){ if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' ) { // se è un'articolo salta la parola e riprende il ciclo $a[$x]=""; } else { // se non è un articolo toglie gli accenti e salva la parola nella variabile di ricerca $a[$x]=str_replace("À","%",$a[$x]); $a[$x]=str_replace("È","%",$a[$x]); $a[$x]=str_replace("É","%",$a[$x]); $a[$x]=str_replace("Ò","%",$a[$x]); $a[$x]=str_replace("Ù","%",$a[$x]); $a[$x]=str_replace("Ì","%",$a[$x]); if ($RicGe == ''){ $RicGe = "(`Titolo` LIKE '%$a[$x]%' OR `Titolo2` LIKE '%$a[$x]%' OR `Autore` LIKE '%$a[$x]%')"; } else { $RicGe = $RicGe . " and (`Titolo` LIKE '%$a[$x]%' OR `Titolo2` LIKE '%$a[$x]%' OR `Autore` LIKE '%$a[$x]%')"; } } } } if ($RicGe<>""){ $RicGe = "(" . $RicGe . ")"; if ($ric<>""){ $ric=$ric . " and " . $RicGe; } else { $ric= $RicGe; } } // scomposizione del titolo in parole chiave togliendo gli articoli $par = $par . " "; $RicPa ='' ; while( trim($par)<>'') { $x++; $a[$x] = ""; $length = strpos( $par, "'" ); // delimita una parola ed elimina il pimo apostrovo e la lettera che precede l'apostrofo if ($length>0) { $a[$x] = strtoupper(substr($par,0,$length-4)); $par = substr($par,($length+1)); }else{ $length = strpos($par," "); // delimita una parola $a[$x] = strtoupper(substr($par,0,$length)); $par= substr($par,($length+1)); } if ($a[$x] <> ''){ if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' ) { // se è un'articolo salta la parola e riprende il ciclo $a[$x]=""; } else { // se non è un articolo toglie gli accenti e salva la parola nella variabile di ricerca $a[$x]=str_replace("À","%",$a[$x]); $a[$x]=str_replace("È","%",$a[$x]); $a[$x]=str_replace("É","%",$a[$x]); $a[$x]=str_replace("Ò","%",$a[$x]); $a[$x]=str_replace("Ù","%",$a[$x]); $a[$x]=str_replace("Ì","%",$a[$x]); if ($RicPa == ''){ $RicPa = "(`Titolo` LIKE '%$a[$x]%' OR `Titolo2` LIKE '%$a[$x]%')"; } else { $RicPa = $RicPa . " and (`Titolo` LIKE '%$a[$x]%' OR `Titolo2` LIKE '%$a[$x]%')"; } } } } if ($RicPa<>""){ $RicPa = "(" . $RicPa . ")"; if ($ric<>""){ $ric=$ric . " and " . $RicPa; } else { $ric= $RicPa; } } // scomposizione del nome collana in parole chiave togliendo gli articoli $col = $col . " "; $RicCo ='' ; while( trim($col)<>'') { $x++; $a[$x] = ""; $length = strpos( $col, "'" ); // delimita una parola ed elimina il pimo apostrovo e la lettera che precede l'apostrofo if ($length>0) { $a[$x] = strtoupper(substr($col,0,$length-4)); $col = substr($col,($length+1)); }else{ $length = strpos($col," "); // delimita una parola $a[$x] = strtoupper(substr($col,0,$length)); $col= substr($col,($length+1)); } if ($a[$x] <> ''){ if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' ) { $a[$x]=""; // se è un'articolo salta la parola e riprende il ciclo } else { // se non è un articolo toglie gli accenti e salva la parola nella variabile di ricerca $a[$x]=str_replace("À","%",$a[$x]); $a[$x]=str_replace("È","%",$a[$x]); $a[$x]=str_replace("É","%",$a[$x]); $a[$x]=str_replace("Ò","%",$a[$x]); $a[$x]=str_replace("Ù","%",$a[$x]); $a[$x]=str_replace("Ì","%",$a[$x]); if ($RicCo == ''){ $RicCo = "`Collana` LIKE '%$a[$x]%'"; } else { $RicCo = $RicCo . " and `Collana` LIKE '%$a[$x]%'"; } } } } if ($RicCo<>""){ $RicCo = "(" . $RicCo . ")"; if ($ric<>""){ $ric=$ric . " and " . $RicCo; } else { $ric= $RicCo; } } // scomposizione dell'autore in parole chiave togliendo gli articoli $aut = $aut . " "; $RicAu ='' ; while( trim($aut)<>'') { $x++; $a[$x] = ""; $length = strpos( $aut, "'" ); // delimita una parola ed elimina il pimo apostrofo e la lettera che precede l'apostrofo if ($length>0) { $a[$x] = strtoupper(substr($aut,0,$length-4)); $aut = substr($aut,($length+1)); }else{ $length = strpos($aut," "); // delimita una parola $a[$x] = strtoupper(substr($aut,0,$length)); $aut= substr($aut,($length+1)); } if ($a[$x] <> ''){ if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' ) { $a[$x]=""; // se è un'articolo salta la parola e riprende il ciclo } else { // se non è un articolo toglie gli accenti e salva la parola nella variabile di ricerca $a[$x]=str_replace("À","%",$a[$x]); $a[$x]=str_replace("È","%",$a[$x]); $a[$x]=str_replace("É","%",$a[$x]); $a[$x]=str_replace("Ò","%",$a[$x]); $a[$x]=str_replace("Ù","%",$a[$x]); $a[$x]=str_replace("Ì","%",$a[$x]); if ($RicAu == ''){ $RicAu = "`Autore` LIKE '%$a[$x]%'"; } else { $RicAu = $RicAu . " and `Autore` LIKE '%$a[$x]%'"; } } } } if ($RicAu<>""){ $RicAu = "(" . $RicAu . ")"; if ($ric<>""){ $ric=$ric . " and " . $RicAu; } else { $ric= $RicAu; } } $edi = $edi . " "; // scomposizione dell'editore togliendo gli articoli $RicEd ='' ; while( trim($edi)<>'') { $x++; $a[$x] = ""; $length = strpos( $edi, "'" ); // delimita una parola ed elimina il pimo apostrovo e la lettera che precede l'apostrofo if ($length>0) { $a[$x] = strtoupper(substr($edi,0,$length-4)); $edi = substr($edi,($length+1)); }else{ $length = strpos($edi," "); // delimita una parola $a[$x] = strtoupper(substr($edi,0,$length)); $edi= substr($edi,($length+1)); } if ($a[$x] <> ''){ if ($a[$x]=='IL' OR $a[$x]=='LO' OR $a[$x]=='LA' OR $a[$x]=='I' OR $a[$x]=='GLI' OR $a[$x]=='LE' ) { $a[$x]=""; // se è un'articolo salta la parola e riprende il ciclo } else { // se non è un articolo toglie gli accenti e salva la parola nella variabile di ricerca $a[$x]=str_replace("À","%",$a[$x]); $a[$x]=str_replace("È","%",$a[$x]); $a[$x]=str_replace("É","%",$a[$x]); $a[$x]=str_replace("Ò","%",$a[$x]); $a[$x]=str_replace("Ù","%",$a[$x]); $a[$x]=str_replace("Ì","%",$a[$x]); if ($RicEd == ''){ $RicEd = "`Editore` LIKE '%$a[$x]%'"; } else { $RicEd = $RicEd . " and `Editore` LIKE '%$a[$x]%'"; } } } } if ($RicEd<>""){ $RicEd = "(" . $RicEd . ")"; if ($ric<>""){ $ric=$ric . " and " . $RicEd; } else { $ric= $RicEd; } } // voce di ricerca anno di edizione if ($anno<>''){ $x++; $a[$x] = $anno; if ($ric<>""){ $ric=$ric . " AND `DataEd` LIKE '$anno%'"; } else { $ric="`DataEd` LIKE '$anno%'"; } } if ($isb<>''){ $isb = substr($isb,0,12); $x++; $a[$x] = $isb; if ($ric<>""){ $ric=$ric . " AND `ISBN13` LIKE '$isb%'"; } else { $ric="`ISBN13` LIKE '$isb%'"; } } if ($cod<>''){ $cod= trim($cod); $x++; $a[$x] = $isb; if ($ric<>""){ $ric=$ric . " AND `codice` LIKE '$cod'"; } else { $ric="`codice` LIKE '$cod'"; } } if ($ric<>""){ setlocale(LC_TIME,"it_IT"); echo "Ricerca di: "; for ($y=1; $y<= count($a); $y++) { echo $a[$y] . " "; } echo "
"; $search = mysql_query("SELECT * FROM `TBL_Libri` WHERE " . $ric . " ORDER BY Dataed DESC"); $total = mysql_num_rows($search); if($total == 0){ echo 'Nessun titolo trovato'."
"; }else{ if ($total==1){ $plu="o"; } else { $plu="i"; } echo $total . " titol" . $plu . " trovat" . $plu ."

"; $i=0; echo ""; while(($r = mysql_fetch_array($search)) AND ($i <= 1000)){ $i++; if ( $i % 2 == 0 ){ $trvar = ""; } else { $trvar = ""; } $filename = "../schede/" . trim($r['Codice']) . ".PHP" ; if ( file_exists ( $filename )) { $titvar = "" . trim($r['Titolo']) . ""; } else { $titvar = "" . trim($r['Titolo']) . ""; } if ( (int)$r['Sconto'] > 0 ) { $prevar = "Sconto " . $r['Sconto'] . "% : € " . $r['Prezzo'] . " " . $r['PrezzoSc'] ; } else { $prevar = " € " . $r['PrezzoSc'] ; } if ( (int)$r['Pagine'] > 0 ) { $desvar = $r['Pagine'] . " p., " ; } else { $desvar = " " ; } if ( trim($r['Dimensioni']) <>'') { $desvar = $desvar . $r['Dimensioni'] . " cm., " ; } if ( $r['Collana'] <>'') { $desvar = $desvar . " collana: " . $r['Collana'] . ", " ; } $mese= array('','gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre'); if ( Substr($r['Dataed'],4,1)== 0) { $d= Substr($r['Dataed'],5,1); } else { $d= Substr($r['Dataed'],4,2); } $data = $mese[$d] . " " . Substr($r['Dataed'],0,4) ; if ( $r['Dataed'] > date("Ymd")) { $dis= "ANTEPRIMA: non ancora pubblicato"; } else { $dis = $r['Disponibile'] ; } if ( $dis=="disponibile" ){ $dis= "subito disponibile"; } $immagine = "".$i . ")" . ""; } echo "
" . $immagine . " alt='immagine di copertina'>" . "

" . $r['Autore'] . "
" . $titvar . "
" . $r['Editore'] . ", " . $data . ", " . $prevar . " (" . $dis . ")
" . $desvar . "ISBN13 " . $r['ISBN13'] . ", " . $r['Codice'] . "

" . "

" . $r['Titolo2'] . " | ". $r['Copie'] . " * " . $r['Scaffale']."

" . "
"; } } else { echo "Inserire una voce per la ricerca."; } } echo "
"; ?>