include_once "myconnect.php";
function main()
{
/////////////getting null char
include "myutente.php";
$config=mysql_fetch_array(mysql_query("select * from astevirtuali_configurazione"));
$null_char[0]=$config["null_char"];
//////////////////////////////leggi dati utente eshop /////////
$rsu=mysql_fetch_array(mysql_query("select * from astevirtuali_utenti where id=$uid"));
///////////////////////////////////session/////////
session_start();
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
setcookie("cart",time()+777600);
setcookie('cart'.'pez',time()+777600);
setcookie('cart'.'not',time()+777600);
setcookie('cart'.'pag',time()+777600);
setcookie('cart'.'sco',time()+777600);
setcookie('cart'.'dove',time()+777600);
setcookie('cart'.'myg',time()+777600);
}
//-----------------------------------------///
if (($_GET['azzera']==1)) {
unset ($_SESSION['cart']);
header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
exit();
}
if (($_GET['empty']==1)) {
$_SESSION['cart'.'pez'][$_GET['pz']] = "0";
echo '';
}
if (isset($_GET['modif'])) {
// Empty the $_SESSION['cart'] array
$_SESSION['cart'.'pez'][$_GET['pz']] = $_GET['qt'];
$_SESSION['cart'.'not'][$_GET['pz']] = $_GET['note']; // $_REQUEST['note'];
// echo '';
}
if (isset($_GET['nota'])) {
$_SESSION['cart'.'not'][$_GET['pz']] =$_REQUEST['note'];
echo '';
}
if($cid>=1)
{
if($cid<=1){$cid="530";} //530 miele ex deve essere 743 coci
$scelta=1;
}
elseif ( isset( $_REQUEST["cid"] ) && $_REQUEST["cid"]!="" )
{
$cid=$_REQUEST["cid"];
$scelta=3;
$_SESSION["u_categ"]=$cid ;
// header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
}
elseif($_SESSION['u_categ']>=1)
{
$cid=$_SESSION['u_categ'];
$scelta=2;
}
else
{
$cid=530; // miele era 743 coci
$scelta=4;
$_SESSION["u_categ"]=0 ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
}
if(!isset($_REQUEST["type"]))
{
$type=1;
}
else
{
$type=$_REQUEST["type"];
}
// ------------ elimina spazi vuoti proima e dopo la stringa ------
$_REQUEST["keyword"]= trim($_REQUEST["keyword"]);
// ------------ fine -----
$strpass="";
if ( isset($_REQUEST["keyword"] ) )
{
$strpass=$strpass . "&keyword=" . $_REQUEST["keyword"];
}
if ( isset($_REQUEST["radio"] ) )
{
$strpass=$strpass . "&radio=" . $_REQUEST["radio"];
}
$strpass=$strpass . "&cid=" . $cid;
$strpass=$strpass . "&uid=" . $uid;
$strpass=$strpass . "&type=" . $type;
$strpass1=$strpass;
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $cid );
if ($rs=mysql_fetch_array($rs_query))
//if ($cid>1)
{
$catname=$rs["cat_name"];
$category=$rs["id"];
$cid=$rs["id"];
$descrizione=$rs["cat_desc"];
$foto1=$rs["cat_foto1"];
$foto2=$rs["cat_foto2"];
}
else
{
$catname="";
$category=0;
$cid=0;
}
$catpath="";
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $category );
while ($rs=mysql_fetch_array($rs_query))
{
$catpath ="> " .$rs["cat_name"]."" . $catpath;
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $rs["pid"] );
}
//$recperpage=12 ; //$config["recperpage"];
$recperpage= $config["recperpage"]*3;
// ---- inizio SQL proncipale .............
$sql="select ";
if ($_REQUEST["radio"]>=1)
{$sql.=" id, product_name, product_subt, soddisfatti, tempi, peso, codice, location, raffina2, raffina3, raffina0, raffina4, raffina, codice, pezzi, pezzi_sconto, sconto_mom, min_sconto, min_bid, max_price,";}
else
{$sql.=" *,";}
$sql.=" DATE_FORMAT(date_submitted,'%d-%b-%Y %r') as postedon,DATE_FORMAT(DATE_ADD(date_submitted,INTERVAL auction_period DAY),'%d-%b-%Y %r') as endson,UNIX_TIMESTAMP(DATE_ADD(date_submitted,INTERVAL auction_period DAY)) as expiry from astevirtuali_prodotti where aucid in (1,3,5,6,7,10,20,25,30)";
if (($type==1) || ($type==9))
{
$date1=date(time());
//$sql.=" and UNIX_TIMESTAMP(DATE_ADD(date_submitted,INTERVAL auction_period DAY)) > $date1 and status='open' and uid=" . $uid;
//$date1=date(time());
//$sql.=" and status='open' and uid=" . $uid;
}
////// leggi pure ditta dalu(12) SEMPRE e se in RICERCA TUTTE /////////////////////////////////////////
$sql.=" and status='open' "; //,'conclusa vend','Venduto'
if (($_REQUEST["radio"]>=1) || ($cid>10))
{ $sql.=" and uid in (175,31,28,27,11,12,14,37,45,72,30,36,38,39,3,4,5,7,8,21,10)";} // 7 è ditta solo lancette e orologio (da fare a parte)
else
{ $sql.=" and uid in (175,31,28,27,11,12,14,37,45,72,30,36,38,39,3,4,5,7,8,21,10) and gallery_featured='yes'";} // gallery_featured = in evidenza .. senpre No ditta 7!
///////////////////////////////////////////////
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==1)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or product_subt like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or codice like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffina like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffinaa like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffinab like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffina3 like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or id like'%".str_replace("'","''",$_REQUEST["keyword"])."%' )";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==2)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%')";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==3)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or product_desc like '%".str_replace("'","''",$_REQUEST["keyword"]). "%')";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==4)
{
$sql=$sql." and ( codice='".str_replace("'","''",$_REQUEST["keyword"])."') ";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==3)
{
$sql0=mysql_query("select id from astevirtuali_utenti where (username like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or fname like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or lname like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or c_name like'%".str_replace("'","''",$_REQUEST["keyword"])."%')");
$u_list="-1";
while($rs_t1=mysql_fetch_array($sql0))
{ $u_list.=",".$rs_t1["id"]; }
// // $sql=$sql." and uid in (".$u_list.")"; già esluso .. percio inutile ---
}
///////////////////////////////////////////////
if ($cid>10)
{
$rst1_query=mysql_query("Select * from astevirtuali_categorie where pid=" . $cid );
$clist=$cid;
while ( $rst1=mysql_fetch_array($rst1_query) )
{
$clist.="," . $rst1["id"];
$rst1_query=mysql_query("Select * from astevirtuali_categorie where pid IN (" . $clist . ") and id not in ( ". $clist . ")") ;
}
$sql.=" and cid in (" . $clist . ") ";
}
//else
//{
//$clist="1";
//$sql.=" and cid=1 ";
//}
////////////////////////////////////////////
//$sql.= " order by endson desc" ;
if($type==9)
{
//$sql.= " order by featured desc, aucid, date_submitted desc" ;
$sql.= " order by featured desc" ;
}
else
{
//$sql.= " order by featured desc, aucid, pezzi desc, date_submitted " ;
$sql.= " order by pezzi desc" ;
}
$rs_query=mysql_query($sql);
///////////////////////////////////PAGINATION /////////
if($pg>=1)
{$scelta=1;}
elseif($_REQUEST['pg']>=1)
{
$pg=$_REQUEST["pg"];
$scelta=3;
$_SESSION["u_pagina"]=$pg ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
$pag=$_SESSION['u_pagina'];
}
elseif($_SESSION['u_pagina']>=1)
{
$pg=$_SESSION['u_pagina'];
$pag=$_SESSION['u_pagina'];
$scelta=2;
}
else
{
$pg=1;
$scelta=4;
$_SESSION["u_pagina"]=1 ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
$pag=$_SESSION['u_pagina'];
}
////////////////////////////////FINE ///PAGINATION /////////
$rcount=mysql_num_rows($rs_query);
if ($rcount==0 )
{
$pages=0;
}
else
{
$pages=floor($rcount / $recperpage);
if (($rcount%$recperpage) > 0 )
{
$pages=$pages+1;
}
}
$jmpcnt=1;
while ( $jmpcnt<=($pg-1)*$recperpage && $row = mysql_fetch_array($rs_query) )
{
$jmpcnt = $jmpcnt + 1;
}
$label=1;
$featured_label=1;
?>
////////////////////////////////FINE ///categoria cid /////////
$_SESSION["visita"][$uid] =$cid; // sta visitando
$_SESSION["pagina"]="listata_merce_mobile"; // sta visitando
///////////////////////////////////////////////////////////////
?>
";
}
else
{
?>
|
}// else
?>
|
|
// echo "L:" . $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>
|
if ($pages>1)
{
?>
|
|
|
}
?>
|
Le nostre categorie più ricercate: |
|
|
|
Piantine Ortaggi già cresciuti per Casa tua: da piantare in Balcone e da adesso i pomodori, i peperoncini le prendi direttamente dalla pianta |
|
|
|
Dolci Tipici Siciliani direttamente a casa tua per gustarti tutta la fragranza e gusto inimitabile dellisola del sole |
|
|
|
Vasto Assortimento di Miele Puro d'Api, Coltivati con sistema tradizionale a Zafferana Etnea (CT): Con sistemi antichi per Darti un Miele PURO al 100% |
|
|
|
selezione di Vini DOC con filiera corta: Vigneti zafferanese (CT) al frantoio all'imbottigliamento |
|
|
|
Olio di Oliva extra vergine PURO selezionato fra i migliori in Sicilia |
|
|
|
Le Migliori conserve sottovuoto introvabili e ricercatissime |
|
|
|
|
}// end main
?>
include_once "tools5_mobile.php";
?>