getRow('SELECT visualname FROM users WHERE id = '.$_COOKIE['promoter_2gg']); echo $nome_promoter['visualname']; } */ function sanatorio($string) { $string = stripslashes($string); $string = strip_tags($string); $string = mysql_real_escape_string($string); return $string; } if(isset($_GET['ref'])){ $REF = sanatorio($_GET['ref']); if(!is_numeric($REF)) $REF = -1; } if(isset($_GET['pr'])) $PR = sanatorio($_GET['pr']); if(isset($_GET['page'])) $PAGE = sanatorio($_GET['page']); if(isset($_GET['old'])) $OLD = sanatorio($_GET['old']); // RICONOSCIMENTO PROMOTER $db = db_connect(); if($REF && $PR){ $pr = $db->getOne('SELECT id FROM users WHERE cod_pr = \''.$PR.'\''); if($pr > 0){ $check_evento = $db->getOne('SELECT COUNT(*) AS numero FROM events WHERE id = '.$REF); if($check_evento > 0){ // AUMENTO DI UNA VISITA AL SITO SE NON C'� GI� IL PR IN SESSION if($_SESSION['promoter'] != $pr){ // INCREMENTO VISITE TOTALI (tabella users) $count = $db->getOne('SELECT visite FROM users WHERE id = '.$pr); $insert = $db->execute('UPDATE users SET visite = '.($count+1).' WHERE id = '.$pr); //SALVO IN SESSION PER NON RIPETERE UNA VISITA SINGOLA $_SESSION['promoter'] = $pr; } // AUMENTO DI UNA VISITA UN EVENTO SE NON CI � PASSATO GI� NEL TEMPO DI UNA SESSIONE if($_SESSION['f'.$REF] != 1){ $count = $db->getOne('SELECT visite FROM dati_promozione WHERE id_evento = '.$REF.' AND id_user = '.$pr.' AND type_evento = \'f\''); if($count > 0) $insert = $db->execute('UPDATE dati_promozione SET visite = '.($count+1).' WHERE id_evento = '.$REF.' AND id_user = '.$pr.' AND type_evento = \'f\''); else $insert = $db->execute('INSERT INTO dati_promozione (id_evento, id_user, type_evento, visite, pagato, metodo_pag) VALUES ('.$REF.', '.$pr.', \'f\', 1, 0, \'aaa\')'); // regisro la singola visite in visite if($_SESSION['userid'] > 0) $id_weblogin = $_SESSION['userid']; else $id_weblogin = 0; $insert = $db->execute('INSERT INTO visite (id_evento, id_user, data, id_weblogin, type_evento) VALUES ('.$REF.', '.$pr.', \''.date('Y').'-'.date('m').'-'.date('d').' '.date('H').':'.date('i').':'.date('s').'\', '.$id_weblogin.', \'f\')'); $_SESSION['f'.$REF] = 1; } // CREO COOKIES PER RICONOSCERE I CLIENTI AL PROMOTER PER 4 GG setcookie('promoter_ec', $pr, time() + 345600, '/'); } } } if($REF) $path = __FILE__.$OLD; else if($OLD == 1){ if($PAGE) $path = __FILE__.'?old=1&page='.$PAGE; else $path = __FILE__.'?old=1'; } else{ if($PAGE) $path = __FILE__.'?page='.$PAGE; else $path = __FILE__; } $nav = 'eventi'; $nome = 'eventi'; $seleziona_menu = 'eventi'; $light = 1; $vendita = 0; if(isset($REF)){ $sql = 'SELECT flag_public FROM events WHERE id = '.$REF; $row = $db->getrow($sql); $link = '/thehive/e20/new/'.$REF.'.jpg'; if (file_exists($link) && $row['flag_public'] == 1) $vendita = 1; $desc = $db->GetRow('SELECT name, address, city, didascalia FROM events WHERE id = '.$REF); if(isset($desc['head_desc'])) $desc1 = $desc['head_desc']; else $desc1 = $desc['name'].' '.$desc['address'].' '.$desc['city']; } include ('../include/prova_header.inc.php'); include ('functions2.inc.php'); if($_GET['error']){ $output .= getOneRecord($REF, 0); } else{ if($REF){ $visite_ART = $db->GetOne('SELECT statistica FROM events WHERE id ='.$REF); $visite_ART = $visite_ART + 1; $db->Execute('UPDATE events SET statistica = '.$visite_ART.' WHERE id ='.$REF); //echo stripslashes($REF); $output .= getOneRecord($REF, 0); } else { $visite = $db->GetOne('SELECT visite FROM statistiche WHERE id = 2'); $visite= $visite + 1; $db->Execute('UPDATE statistiche SET visite = '.$visite.' WHERE id = 2'); $output .= getList(); } } ?>