codice:
<link rel="stylesheet" type="text/css" href="stileprova.css">
<link href='http://fonts.googleapis.com/css?family=Cutive+Mono' rel='stylesheet' type='text/css'>
<script>
var tasto;
function conferma() {
if(tasto=="due") return confirm('L\'annuncio verrà cancellato definitivamente,\n\nConfermi?');
}
</script>
<?php
$_SESSION['url_home']="index.php";
$_SESSION['url_citta']="http://www.google.it";
$_SESSION['url_login']="/login.php#testa";
$_SESSION['url_chisiamo']="chisiamo.php";
$_SESSION['url_contatti']="contatti.php";
$_SESSION['url_condizioni']="condizioni.php";
$_SESSION['url_privacy']="privacy.php";
$_SESSION['url_pubblicita']="pubblicita.php";
$_SESSION['url_suggerimenti']="suggerimenti.php";
function pubb728x90 ()
{
print("<script type=\"text/javascript\">
/* <![CDATA[ */
document.write('<s'+'cript type=\"text/javascript\" src=\"http://ad.altervista.org/js.ad/size=728X90/r='+new Date().getTime()+'\"></s'+'cript>');
/* ]]> */
</script>");
}
function pubb300x250()
{
print("<script type=\"text/javascript\">
/* <![CDATA[ */
document.write('<s'+'cript type=\"text/javascript\" src=\"http://ad.altervista.org/js.ad/size=300X250/r='+new Date().getTime()+'\"><\/s'+'cript>');
/* ]]> */
</script>");
}
function testata()
{
$a= session_status();
echo "<font color='red'>stato: $a</font>";
session_unset();
echo "
<font color='red'>stato2: ".session_status()."</font>";
echo "
session:".session_id()."
";
if ( session_id() == NULL)
{
session_start();
echo "session start";
echo "
".session_id();
}
else echo "sessione avviata";
require ("mysql.php");
echo "<table width=100% class='testata'>";
echo "<tr height='40'><td width='10'></td><td><font size='4' color='white'>IGLESIAS<font color='red'>CASE</font></td>";
if (!isset ($_POST['submit']))
{
$_SESSION['usertrovato']=0;
$_SESSION['passtrovata']=0;
$errore=0;
}
else
{
$tabella = mysql_query("SELECT * FROM lista_utenti ",$db);
while ($utenti= mysql_fetch_row ($tabella))
{
if ( $_POST['username'] == $utenti[1])
{
$_SESSION['usertrovato']=1;
if ( md5($_POST['password'])== ($utenti[2]))
{
$_SESSION['passtrovata']=1;
$_SESSION['id_utente']=$utenti[0];
$_SESSION['username']=$_POST['username'];
$_SESSION['login']=1;
$tabella2 = mysql_query("SELECT * FROM lista_admin ",$db);
while ($utenti2= mysql_fetch_assoc ($tabella2))
{
if ($utenti2['username']== $utenti[1])
{
$_SESSION['admin']=$utenti2['username'];
break;
}
}
}
else
{
$_SESSION['passtrovata']=0;
$_SESSION['id_utente']="";
}
break;
}
else
{
$_SESSION['usertrovato']=0;
$_SESSION['id_utente']="";
}
}
}
if (isset($_POST['submit']))
{
if (($_SESSION['usertrovato'] ==1)&&($_SESSION['passtrovata']==1))
{
if (isset($_SESSION['admin']))
{//echo "<font color='red'>".$_SESSION['admin']."</font>";
header("Location: http://www.iglesiascase.it/admin.php");
exit;
}
else
{
header("Location: /login_effettuato.php");
exit;
}
}
else $errore=1;
}
if (isset($_SESSION['login']) &&($_SESSION['login']==1))
{
echo "<td>Benvenuto ";
if (isset($_SESSION['admin'])) echo "amministratore ";
echo "<font color='red'>".$_SESSION['username']."</font> | ";
if (isset($_SESSION['admin'])) echo "<font color='white'>Pannello di controllo Admin | ";
echo "<font color='white'>Pannello di controllo | <font color='red'> Logout</td>";
}
else
{
echo "<td><form method='post' action='".$_SERVER['PHP_SELF']."'> Nome utente <input type='text' name='username' maxlength='10' size='10'> Password<input type='password' maxlength='10' size='10' name='password'> ";
echo "<input type='submit' name='submit' value='Login'>";
if ($errore==1) echo "<font color='red' size='2'> Nome utente o password errati</font>";
echo "</td><td ><font color='white'>Registrati</td>";
}
echo "<td><font color='red'> Pubblicità</td>";
echo "</form></td></tr></table>";
}
function crea_menu_categorie()
{ //INSERIRE CATEGORIE e relativi url
$categorie=array("Città","Campagna","Centro storico","Periferia","Frazioni");
//$url=array("http://www.google.it","http://www.google.it","http://www.google.it","http://www.libero.it","http://www.google.it");
$num_categorie=sizeof($categorie);
echo "<table cellpadding='0' cellspacing='0' height='3'><tr><td></td></tr></table>";
echo "<table cellspacing='0' width=80% height='50' border='0' align='center' background='/Immagini/giallo2.jpg'>";
echo "<tr height='50'>";
for ($cont=0;$cont < $num_categorie;$cont++)
{
if ( (isset($_SESSION['categoria'])) && ($_SESSION['categoria']==$categorie[$cont]))
{
echo "<td bgcolor='red' align='center' valign='middle'>";
echo "".$categorie[$cont]."</td>";
}
else
{
echo "<td align='center' valign='middle'>";
echo "<a class='categorie' href='/categoria.php?categ=".$categorie[$cont]."'>".$categorie[$cont]."</td>";
}
}
echo "</tr></table>";
}
function crea_menu_testata()
{
$url_home="http://www.libero.it"; //INSERIRE url pagine del sito!!!
$url_inserisciannuncio="/ins_annuncio_no_login.php";
$url_login="/login.php";
$citta="Iglesias"; //definzione località
$tipo="Case";
echo "<table class='testata2' width=80% height='150' border='0' align='center' >";
echo "<td width='10'></td><td valign='middle'>";
echo "<a class='iglesiascase' href='/index.php?set=1'>".strtoupper($citta)."<font color='white'>". strtoupper($tipo)." </font></td>";
echo "<td width=30% ><h3>Annunci di <font color='white'>".$tipo."</font>". " in vendita località <font color='white'>".$citta."</font></h3></td>";
echo "<td width=\"40%\" align=\"right\" valign=\"middle\"> <font size='5'> NUOVO ANNUNCIO GRATIS!</td><td width='10'></td>";
echo "</tr></table>";
}
function menu_bottom()
{
echo "<table width=80% align='center' border='0'>";
echo "<tr height='15'><td colspan='13'><hr></td></tr>";
echo "<tr><td align='center'><a href='".$_SESSION['url_home']."'>Home</td><td width='4'>|</td>";
echo "<td align='center'><a href='".$_SESSION['url_chisiamo']."'>Chi siamo</td><td width='4'>|</td>";
echo "<td align='center'><a href='".$_SESSION['url_contatti']."'>Contatti</td><td width='4'>|</td>";
echo "<td align='center'><a href='".$_SESSION['url_condizioni']."'>Condizioni</td><td width='4'>|</td>";
echo "<td align='center'><a href='".$_SESSION['url_privacy']."'>Privacy</td><td width='4'>|</td>";
echo "<td width='250' align='center'><a href='".$_SESSION['url_suggerimenti']."'>Suggerimenti e segnalazioni</td><td width='4'>|</td>";
echo "<td align='center'><a href='".$_SESSION['url_pubblicita']."'>Pubblicità</td></tr>";
echo "</table>";
}
function invia_mail_contatto($mittente,$destinatario,$testo,$nome,$nome_dest,$telefono)
{
$oggetto = "Iglesiascase.it - Contatto per il tuo annuncio";
$messaggio = "<html><body><font face='Palatino,Georgia,Baskerville,serif' color='black' size='6'>IGLESIAS<font color='red'>CASE.IT</font></font>
<font size='5'>Ciao ".$nome_dest."!</font>
La presente email è stata generata in automatico da Iglesiascase.it";
$messaggio.= ", per contattare l'utente che ti ha scritto non rispondere a questa email,
puoi contattarlo telefonicamente se nel messaggio che segue ha specificato il numero, oppure invia un'email a $mittente
";
$messaggio .= "<font size='4' ><u>Messaggio inviato da $nome</u></font>
(Email:$mittente)";
if ($telefono != NULL) $messaggio .= " (Telefono: $telefono)
Testo:
$testo
</body></html> ";
else $messaggio .= "
Testo:
$testo
</body></html> ";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";
$headers = "From: info@iglesiascase.it \r\n";
$headers .= "content-type: text/html; charset=iso-8859-1\r\n";
if(mail($destinatario, $oggetto, $messaggio, $headers))
return true;
else
return false;
}
function invia_mail($email_mittente,$destinatario,$nome_mittente,$oggetto,$testo)
{
$messaggio = "<html><body><font face='Palatino,Georgia,Baskerville,serif' color='black' size='6'>IGLESIAS<font color='red'>CASE.IT</font></font>
";
$messaggio .= "<font size='4' ><u>Messaggio inviato da $nome_mittente</u></font>
(Email:$email_mittente)";
$messaggio .= "
Testo:
$testo
</body></html> ";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";
$headers = "From: info@iglesiascase.it \r\n";
$headers .= "content-type: text/html; charset=iso-8859-1\r\n";
if(mail($destinatario, $oggetto, $messaggio, $headers))
return true;
else
return false;
}
function sito_in_costruzione()
{
echo "<table width=80% height='200' border='0' align='center'> <tr ><td width='250'>[img]/Immagini/under.jpg[/img]</td><td align='center' valign='middle'><font size='6'>Sito in costruzione</font></td><td width='250'align='right'>[img]/Immagini/under.jpg[/img]</td></tr></table>";
}
function anteprima_annuncio($record,$tabella)
{
require ("mysql.php");
$annuncio = mysql_query("SELECT * FROM $tabella WHERE id=".$record,$db);
$foto=mysql_result($annuncio,0,'foto1_thumb');
$id=mysql_result($annuncio,0,'id');
echo "<tr><td width='150'> <input type ='submit' class='submit_image' style='background-image: url($foto); width: 128px; height: 96px;' width='128' height='96' name='invia' value='$id'></td>";
echo "<td><input type='hidden' name='rec' value='$id'> <button type='submit' class='nobutton' name='invia2'>". mysql_result($annuncio,0,'titolo')."</button>".mysql_result($annuncio,0,'prezzo')." € </td></tr>";
echo "<tr height='10'><td colspan='2'><hr></td></tr>";
}
function anteprima_admin($record,$tabella)
{
require ("mysql.php");
$annuncio = mysql_query("SELECT * FROM $tabella WHERE id=".$record,$db);
$foto1=mysql_result($annuncio,0,'foto1_thumb');
$foto2=mysql_result($annuncio,0,'foto2_thumb');
$foto3=mysql_result($annuncio,0,'foto3_thumb');
$id=mysql_result($annuncio,0,'id');
echo "<tr><td width='130'> <img src=$foto1 width='128' height='96'></td>";
if ($foto2!=NULL) echo "<td width='130'><img src=$foto2 width='128' height='96'></td>";
else echo "<td width='130' align='center'>Foto 2
Assente</td>";
if ($foto3!=NULL) echo "<td width='130'><img src=$foto3 width='128' height='96'></td>";
else echo "<td width='130' align='center'>Foto 3
Assente</td>";
echo "<td><u>Utente: ".mysql_result($annuncio,0,'utente')."</u> (Stato: ".mysql_result($annuncio,0,'stato').")
";
echo "".mysql_result($annuncio,0,'titolo')."
".mysql_result($annuncio,0,'prezzo')." €</td></tr>";
echo"<tr><td colspan='4'>Categoria: ".mysql_result($annuncio,0,'categoria')."</td></tr>";
echo"<tr><td colspan='4'>Descrizione: ".mysql_result($annuncio,0,'descrizione')."</td></tr>";
echo"<tr><td colspan='4'>Anno: ".mysql_result($annuncio,0,'anno_fabbricazione')."</td></tr>";
echo"<tr><td colspan='4'>Privato/Azienda: ".mysql_result($annuncio,0,'privato_azienda')."</td></tr>";
echo"<tr><td colspan='4'>Vendita/Affitto: ".mysql_result($annuncio,0,'vendita_affitto')."</td></tr>";
}