// Modulo di ricerca utenti/tags/foto per il sito www.imagesurfing.com (by Speziale Alessandro)
//include("functions.php");
require('settings.php');
require("./admin/config.php");
//funzione x multilanguage
/*
$time = time();
if (isset($cookie_data)) {
$cookie_info = explode("&", $cookie_data);
$f_name = $cookie_info[0];
$l_name = $cookie_info[1];
$visits = $cookie_info[2];
$lingua = $cookie_info[3];
$visits ++;
$cookie_string = $f_name.'&'.$l_name.'&'.$visits.'&'.$lingua;
setcookie ("cookie_data",$cookie_string, $time+3600*24);
}
include ("lang.php") ;
// controllo echo"$diz_contattaci";
*/
//include('templates/default/header.html');
$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass");
if (!$connection) {
echo "Couldn't make a connection!";
exit;
}
$db = mysql_select_db("$sqldb", $connection);
if (!$db) {
echo "Couldn't select database!!!!";
exit;
}
echo "
\n";
?>
//se la variabile del form è vuota allora prende il dato dal form di ricerca altrimenti tiene il tag prefissato su cui si è cliccato
if($tagpost==""){
$tagpost = $_POST['tag01']; }
// cerca i tag nel database e visualizza le foto con riscontri
if($cercatag=="on"){
$sqltag=mysql_query("select * from $table_tag where tag='$tagpost' ");
//$sqltag_result = mysql_query($sqltag,$connection);
$totale = mysql_num_rows($sqltag);
$totalepost=$totale;
if ($totale=="0"){$testo="Spiacente non ci sono riscontri per il tag $tagpost
- Prova a cercare una parola simile
- Se la tua ricerca era composta da piu parole prova con una sola";}
else {
//se il tag esiste allora controlla nella cloud (se esiste nella cloud aggiunge 1 al contatore altrimenti mette il tag e parte da 1)
$sql_cloud=mysql_query("select * from $table_cloud where termine='$tagpost'");
$row2 = mysql_fetch_array($sql_cloud);
$id_termine= $row2["id"];
$termine= $row2["termine"];
$contatore= $row2["contatore"];
$controllo = mysql_num_rows($sql_cloud); //da il numero di righe
if($tagpost!= "" and $controllo==0){
$termine_new = mysql_query( "insert into $table_cloud (id, termine, contatore) VALUES ('', '$tagpost', '1')");
}else{
$contatore2 = $contatore +1;
$termine_old = mysql_query( "update $table_cloud set contatore='$contatore2' where termine='$tagpost' ");
}
//fine parte per tag_cloud
while ($row = mysql_fetch_array($sqltag)) {
$idtag= $row["id"];
$parola= $row["tag"];
$nomepost= $row["nomepost"];
$idpost= $row["idpost"];
//trova il post associato
$sqltag2=mysql_query("select * from $table where ID='$idpost'");
// $sqltag2_result = mysql_query($sqltag2,$connection);
$testotag="+ $tagpost ( $totalepost articles found ) |
";
while ($row2 = mysql_fetch_array($sqltag2)) {
$postid = $row2["ID"];
$posttitolo = $row2["title"];
$postdata = $row2["date"];
$poster = $row2["poster"];
$post = $row2["news"];
$postcat = $row2["Cat"];
$postsub = $row2["subtitle"];
$postmod = $row2["datamod"];
$posthit = $row2["hit"];
//immagini associate al post
$sqlimg=mysql_query("select * from $table_img where post=$postid ");
$totale=mysql_num_rows($sqlimg);
$row3 = mysql_fetch_array($sqlimg);
$imageid = $row3["id"];
$imagename = $row3["name"];
$imagepost = $row3["post"];
if ($totale==0){$immagine="";}
else{
$immagine=" ";
}
//fine imamgini
$message = substr($post,0,$position); // Display your message
$testo= $testo."
Tags: ";
$sqltag3=mysql_query("select * from $table_tag where idpost='$postid'");
while( $row2 = mysql_fetch_array($sqltag3)){
$id_termine2= $row2["id"];
$termine2= $row2["tag"];
$testo=$testo."
$termine2 ";
}
} $testo=$testo."
";
}
} }
//funzione per visualizzare le categorie
//visualizza l'elenco delle categorie --------------------------------------------------------------------------------------
$result1 = mysql_query("select * from $table_cat order by nome");
while (list($id,$nome) = mysql_fetch_row($result1)) {
// visualizzazione
$categorie = $categorie."
$nome
";
$nocat = "Spiacente, non ci sono ancora news per questa categoria";
}
//fine categorie
$content_array = file("$theme/search.html");
$template= implode("", $content_array);
// $top = getStats($loggedinName);
// $catlist = listCatagory();
//$prof = getProfilebox($userid);
// $totpics = getTotpics();
//$template = getMemberbox($loggedinName,$template);
//$Links = getResources();
$template = str_replace('$titolopagina', "- $tagpost\n", $template);
$template = str_replace('<:STATS:>', "$top\n", $template);
$template = str_replace('<:INFOTEXT:>', "$UploadinfoText\n", $template);
$template = str_replace('<:RESOURCES:>', "$Links", $template);
$template = str_replace('<:OL:>', "$online\n", $template);
$template = str_replace('<:ID:>', "$id\n", $template);
$template = str_replace('<:UCOMMENTS:>', "$ucomments\n", $template);
$LoginName = ucwords($loggedinName);
$template = str_replace('<:LOGINNAME:>', "$LoginName\n", $template);
$template = str_replace('<:TP:>', "$totpics\n", $template);
$template = str_replace('<:VL:>', "$votesleft\n", $template);
$template = str_replace('<:TITLE:>', "$title\n", $template);
$template = str_replace('<:CAT:>', "$catlist\n", $template);
$template = str_replace('<:CATBOX:>', "$catbox\n", $template);
$template = str_replace('<:TEXT:>', "$testo", $template);
$template = str_replace('<:TEXTTAG:>', "$testotag", $template);
$template = str_replace('<:CATAGORY:>', "$catlist", $template);
$template = str_replace('<:USERID:>', "$loggedinName\n", $template);
$template = str_replace('$sitename', "$sitename\n", $template);
$template = str_replace('<:PAGE:>', "$PHP_SELF\n", $template);
$template = str_replace('<:CATEGORIE:>', "$categorie\n", $template);
//multilanguage primi 7 comuni
$template = str_replace('$diz_iscriviti', "$diz_iscriviti\n", $template);
$template = str_replace('$diz_contattaci', "$diz_contattaci\n", $template);
$template = str_replace('$diz_piu_votati', "$diz_piu_votati\n", $template);
$template = str_replace('$diz_siti_amici', "$diz_siti_amici\n", $template);
$template = str_replace('$diz_password_dimenticata', "$diz_password_dimenticata\n", $template);
$template = str_replace('<:USERS:>', "$diz_utenti_online\n", $template);
$template = str_replace('<:PHOTOS:>', "$diz_foto\n", $template);
$template = str_replace('$footer', "$diz_copyright\n", $template);
//multilingua pannello controllo
$template = str_replace('$diz_pannello', "$diz_pannello", $template);
$template = str_replace('$diz_carica', "$diz_carica", $template);
$template = str_replace('$diz_gestisci', "$diz_gestisci", $template);
$template = str_replace('$diz_profilo', "$diz_profilo", $template);
$template = str_replace('$diz_messaggi', "$diz_messaggi ", $template);
$template = str_replace('$diz_contatti', "$diz_contatti ", $template);
echo $template;
//include('templates/default/footer.html');
?>